File tree Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Expand file tree Collapse file tree 1 file changed +5
-8
lines changed Original file line number Diff line number Diff line change @@ -208,15 +208,12 @@ def init_twisted_greenlet():
208
208
209
209
def stop_twisted_greenlet ():
210
210
if _instances .gr_twisted :
211
- # check if the reactor is not stopped first to prevent calling stop() twice which results
212
- # into an error, traceback printed and process hanging until it is killed with SIGKILL.
213
- # This sometimes happens when the pytest process is sent a SIGINT signal.
214
- # The reactor will stop itself as it register a SIGINT signal for itself and then it is
215
- # stopped second time here.
216
- # I don't understand when exactly is this happening but I am also observing here that
217
- # reactor.running == True and reactor._stopped == True.
218
- if not _instances .reactor ._stopped :
211
+ try :
219
212
_instances .reactor .stop ()
213
+ except error .ReactorNotRunning :
214
+ # Sometimes the reactor is stopped before we get here. For example, this can
215
+ # happen in response to a SIGINT in some cases.
216
+ pass
220
217
_instances .gr_twisted .switch ()
221
218
222
219
You can’t perform that action at this time.
0 commit comments