Kill greenlets with notify
This commit is contained in:
parent
6c31a3b77e
commit
9299e5b614
2 changed files with 4 additions and 3 deletions
|
@ -106,7 +106,7 @@ class SiteAnnouncer(object):
|
|||
gevent.joinall(threads, timeout=20) # Wait for announce finish
|
||||
|
||||
for thread in threads:
|
||||
if thread.value is None or type(thread.value) is GreenletExit:
|
||||
if thread.value is None:
|
||||
continue
|
||||
if thread.value is not False:
|
||||
if thread.value > 1.0: # Takes more than 1 second to announce
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import gevent
|
||||
from Debug import Debug
|
||||
|
||||
|
||||
class GreenletManager:
|
||||
|
@ -17,7 +18,7 @@ class GreenletManager:
|
|||
self.greenlets.add(greenlet)
|
||||
return greenlet
|
||||
|
||||
def stopGreenlets(self, reason="Stopping greenlets"):
|
||||
def stopGreenlets(self, reason="Stopping all greenlets"):
|
||||
num = len(self.greenlets)
|
||||
gevent.killall(list(self.greenlets))
|
||||
gevent.killall(list(self.greenlets), Debug.Notify(reason), block=False)
|
||||
return num
|
||||
|
|
Loading…
Reference in a new issue