Skip to content

Schedulers using different now() implementation breaks schedule_absolute() compatibility. #724

@Sduby22

Description

@Sduby22

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions