safe usage of gevent.Timeout
Related to #3209
gevent.Timeout
is often not used properly. See here for more details.
This MR adds bliss.common.gevent_utils
for correct usage of gevent API which involves gevent.Timeout
:
-
with gevent.Timeout(...):
:gevent_timeout
orgevent_timeout_silent
-
Greenlet.get
:greenlet_get
-
gevent.killall
:gevent_killall
There are other more rare gevent
calls like gevent.event.AsyncResult.get
which could raise gevent.Timeout
. I did not make utilities for those but they should be used like greenlet_get
.
I left low levels comms, controllers, scans and Flint untouched as it is too complicated to understand the implications of modifying their gevent.Timeout
usage. Those gevent.Timeout
calls make the entire greenlet go down when raised, which is most likely not what was intended. But we will have to check this one by one.
Edited by Wout De Nolf