return Observable
.Timer(TimeSpan.FromSeconds(2))
.SelectAsync(delegate { return this.getResponse(request); })
.Repeat()
.Timeout(TimeSpan.FromSeconds(10), Observable.Return(new InMemoryDataSetIsGoodResponse(false, "Connection to Mongo timed out after 10 seconds."))
.SkipWhile(r => r.IsGood)
.Take(1)
.StartWith(new InMemoryDataSetIsGoodResponse(true, null)));
I want to poll a database to make sure that a particular record is still in the database. getResponse
returns an IsGood
response as long as the record is there, then it returns a bad response.
I just want to start with the assumption that it's there and do nothing until it's bad, at which point I just want to publish the bad response once and be done with it.
But an observer sees an IsGood
response every two seconds. Can anyone explain that?