RxPY icon indicating copy to clipboard operation
RxPY copied to clipboard

Schedulers using different `now()` implementation breaks `schedule_absolute()` compatibility.

Open Sduby22 opened this issue 11 months ago • 0 comments

Hi, I found that operators like

take_until_with_time(datetime)

depends on

scheduler.schedule_absolute(duetime)

to trigger, which then was implemented as

scheduler.schedule_relative(duetime - self.now)

For normal schedulers which uses default_now(), it uses datetime.now() implementation

For some schedulers like AsyncIOScheduler, it uses some event_loop internal monotonic clock for self.now, which may be far from current timestamp, and may break schedule_absolute if a user passes regular datetime.

Why is it needed to use per-scheduler now implementation? If this is the expected behavior, I think we might consider clarify the doc as such

end_time (Union[datetime, timedelta, float]) – Time to stop taking elements from the source sequence. 
If this value is less than or equal to datetime.utcnow(), the result stream will complete immediately.
                                          ^^^^^^^^^^^  scheduler.now()

Sduby22 avatar Nov 30 '24 14:11 Sduby22