Nishant
Nishant

Reputation: 21924

What happens if there are timed events when Twisted's reactor is blocking?

I am new to event-driven programming paradigm and was reading about Twisted.

In this question about Reactor, How does Python's Twisted Reactor work?

 timeout = time_until_next_timed_event()
 events = wait_for_events(timeout)
 events += timed_events_until(now())

logically wouldn't there be a scenario where timeout = time_until_next_timed_event() was computed as 12 Hours, and event = wait_for_events(timeout) just waits for 12 Hours since no external trigger happened and it just missed serving any timed_events_until(now()) events which ideally it could have? Isn't that a compromise?

I am pretty sure I am missing something, can anyone clarify this from a logical perspective?

Upvotes: 0

Views: 118

Answers (1)

Nathaniel J. Smith
Nathaniel J. Smith

Reputation: 12762

If the next timed event is 12 hours from now, then by definition it will be 12 hours until timed_events_until(now()) returns any events.

Upvotes: 2

Related Questions