You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An observable created by reactivex.timer(1,5) will emit immediately when a second observer subscribes instead of waiting the "1" second specified as argument. This only happens when an interval value is specified
deftest_timer_with_interval_repeat():
scheduler=TestScheduler()
source=reactivex.timer(10, 200, scheduler=scheduler)
result=scheduler.start(
lambda: source.pipe(
operators.take(2),
operators.repeat(),
)
)
assertresult.messages== [
on_next(210, 0),
on_next(410, 1),
on_next(420, 0), # <- here it will actually emit at 410on_next(620, 1), # then 610on_next(630, 0), # and again at 610, missing the "10" ticks from the timeron_next(830, 1), # etc...on_next(840, 0),
]
Expected the timer to be "reset" regardless if we resub on repeat or with a second observer
Additional findings:
it only happens when there is an interval value; non repeating timers don't have the issue
using a operators.delay we see that the next intervals follow the second subscription, meaning, they are correct relative to the first emission but wrong relative to expected behavior
reactivex.interval does not seem to have this issue
RxPY 4.0.4
Python 3.10
The text was updated successfully, but these errors were encountered:
An observable created by
reactivex.timer(1,5)
will emit immediately when a second observer subscribes instead of waiting the "1" second specified as argument. This only happens when an interval value is specifiedExpected the timer to be "reset" regardless if we resub on repeat or with a second observer
Additional findings:
operators.delay
we see that the next intervals follow the second subscription, meaning, they are correct relative to the first emission but wrong relative to expected behaviorreactivex.interval
does not seem to have this issueThe text was updated successfully, but these errors were encountered: