I’ve got new question about one (or two) Reactive methods. In my scenario I needed an observable sequence capable of suppressing other emitted Tasks while the first Task wasn’t completed, and ended up with something like this:
Observable.Interval(TimeSpan.FromMilliseconds(200))
.Select(x => Observable.FromAsync(async () =>
{
await Task.Delay(1000);
// Simulating long running task
Console.WriteLine(x);
}))
.Publish(x => x.FirstAsync().SelectMany(c => c).Repeat())
.Subscribe();
I tried to Google but I really can’t explain few things:
- First of all, how that works ?
- What is exactly on that Reactive sequence that blocks the observable from reaching the subscription?
What exactly
Replay
does in that? Isn’tReplay
supposed to replay the Task in this case? Or I don’t know. Can anyone explain detailed every step in that Reactive query? What doesPublish
with that kind of selector. HowReplay
is playing in that query? And why do I need to callSelectMany
onFirstAsync
if only one element will be emitted anyway.