Race Condition issue
Race Condition issue
Race Condition

Issue: Race condition, when the user makes changes to input, there are cases where the previous data overrides the latest API call.

To solve this race condition, we can either make streams synchronous so that the last stream gets started if the previous stream is completed or cancel the previous stream and have only one stream active. This can be achieved by using ConcatMap and SwitchMap respectively. We will also be using debounce time and distinctUntilChanged to emit events once the user stops making changes to the data and will not emit events if the data is the same.


I have been working in software development for four years and was aware of Reactive programming but never implemented it. I got a chance to work on a new module and started implementing reactive programming. Here are some key insights.

I always read that reactive programming deals very well with “asynchronous” tasks and think of everything as streams. I always read that but never understood it. I just want to explain what I learned recently.

There are a lot of asynchronous activities going on in the application like API calls, user events… etc.

Let’s take an example.

  1. I have a…

Rakesh Chitturi

Working as a full stack developer for 4 years and always learning.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store