-
Notifications
You must be signed in to change notification settings - Fork 135
Open
Description
If a message takes 5 seconds to be processed as it involves some database operations, it shouldn't slow the server processing pipeline overall as that's going to cause backpressure. In such situations I really wonder what @Marfusios you would do:
- Making server message processing run in parallel
public static IDisposable SubscribeAsync<T>(this IObservable<T> source, Func<T, Task> onNext) =>
source
.Select(item => Observable.FromAsync(() => onNext(item)))
.Merge()
.Subscribe();instead of
public static IDisposable SubscribeAsync<T>(this IObservable<T> source, Func<T, Task> onNext) =>
source
.Select(item => Observable.FromAsync(async () => await onNext(item)))
.Concat()
.Subscribe();- Offload the data processors/handlers to a separate thread
What do you think is best? Both solutions are working but I kinda want to know someone else's opinion.
Metadata
Metadata
Assignees
Labels
No labels