mirror of
http://aero2k.de/t/repos/urlbot-native.git
synced 2017-09-06 15:25:38 +02:00
fix 'hangup' to finish all threads
This commit is contained in:
@@ -23,6 +23,8 @@ joblist = []
|
|||||||
|
|
||||||
plugins = {p : [] for p in ptypes}
|
plugins = {p : [] for p in ptypes}
|
||||||
|
|
||||||
|
got_hangup = False
|
||||||
|
|
||||||
def pluginfunction(name, desc, plugin_type, ratelimit_class = RATE_GLOBAL, enabled = True):
|
def pluginfunction(name, desc, plugin_type, ratelimit_class = RATE_GLOBAL, enabled = True):
|
||||||
''' A decorator to make a plugin out of a function '''
|
''' A decorator to make a plugin out of a function '''
|
||||||
if plugin_type not in ptypes:
|
if plugin_type not in ptypes:
|
||||||
@@ -736,6 +738,8 @@ def else_command(args):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def data_parse_commands(msg_obj):
|
def data_parse_commands(msg_obj):
|
||||||
|
global got_hangup
|
||||||
|
|
||||||
data = msg_obj['body']
|
data = msg_obj['body']
|
||||||
words = data.split()
|
words = data.split()
|
||||||
|
|
||||||
@@ -748,6 +752,7 @@ def data_parse_commands(msg_obj):
|
|||||||
|
|
||||||
if 'hangup' in data:
|
if 'hangup' in data:
|
||||||
logger('warn', 'received hangup: ' + data)
|
logger('warn', 'received hangup: ' + data)
|
||||||
|
got_hangup = True
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@@ -857,6 +862,9 @@ def register_all():
|
|||||||
register(ptypes_COMMAND)
|
register(ptypes_COMMAND)
|
||||||
|
|
||||||
def event_trigger():
|
def event_trigger():
|
||||||
|
if got_hangup:
|
||||||
|
return False
|
||||||
|
|
||||||
if 0 == len(joblist):
|
if 0 == len(joblist):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user