Hey folks!
I was reading Chapter 14 (the part about retrying requests, specifically where we return Observable<Int>.timer(Double(attempt + 1), scheduler: MainScheduler.instance).take(1)
in the retryHandler
and was wondering how Observable.Timer
works under the hood.
Firstly, does it use NSTimer? I tried digging through the code, and got lost between scheduleRelative
and TimerOneOffSink
Secondly, if it does, how does it manage the lifetime of the Timer objects? How does it invalidate them? (This would be especially important if you’re using them in a flatmap context, because then you’d be making new Timer objects ALL the time)