Large amounts of notifications can block reactor
mb5 opened this issue · 3 comments
Due to the current implementation of checkForNotifies
, the reactor thread could spent quite a lot of time in the while self._connection.notifies
loop if the amount of notifications is high. This will cause some unexpected results in program behavior.
It would be nice if notifications are dispatched to the observer more gracefully, eg. making connection.notifies
a DeferredQueue
and having a t.i.t.Cooperator
consume that queue and notify observers accordingly.
The same applies if the reactor spends a lot of time in for observer
loop.
True, I've never really checked for blocking behaviour with a high NOTIFY load.
I'll see what I can do, thanks for noticing!
I fixed the code to use a Cooperator (it uses internet.task.cooperate by default and you can provide your own).
Does this help with your reactor blocking problem?
Probably... will report back in the new year :)