thangchung / modular-starter-kit

The starter kit with entire modular approach to help remove boilerplate code in developing
MIT License
15 stars 9 forks source link

Core: Back Pressure for some of heavy reactive requests #15

Open thangchung opened 6 years ago

thangchung commented 6 years ago

The workaround solution can be found at https://stackoverflow.com/questions/42236757/handling-backpressure-in-rx-net-without-onbackpressurelatest and the discussion for it at https://github.com/Reactive-Extensions/Rx.NET/issues/19

Full explanation about it at http://reactivex.io/documentation/operators/backpressure.html

softlion commented 2 years ago

The workaround solution can be found at https://stackoverflow.com/questions/42236757/handling-backpressure-in-rx-net-without-onbackpressurelatest and the discussion for it at dotnet/reactive#19

Well there are 2 issues with this answer. 1) it does not work well with tasks that are scheduled on multiple threads (lock is not task aware: it locks only when on the same thread, not in the same task - as one task can be dispatched on multiple threads during its lifetime). 2) it will work only as the latest operator in the chain. So for example if you want it before an API call in order to prevent multiple simultaneous calls to the same api, it's not usable (in a rare case this API takes 20s to answer for example).