mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-30 09:47:17 +00:00
Merge remote-tracking branch 'upstream/master' into production
This commit is contained in:
commit
303575b2a1
1 changed files with 27 additions and 11 deletions
|
@ -124,6 +124,16 @@ def isJSON(content):
|
||||||
except Exception,e:
|
except Exception,e:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
import signal
|
||||||
|
|
||||||
|
class TimeoutException(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def timeout_handler(signum, frame):
|
||||||
|
raise TimeoutException
|
||||||
|
|
||||||
|
signal.signal(signal.SIGALRM, timeout_handler)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# If you wish to use an other port of channel, do not forget to run a subscriber accordingly (see launch_logs.sh)
|
# If you wish to use an other port of channel, do not forget to run a subscriber accordingly (see launch_logs.sh)
|
||||||
# Port of the redis instance used by pubsublogger
|
# Port of the redis instance used by pubsublogger
|
||||||
|
@ -152,6 +162,12 @@ if __name__ == '__main__':
|
||||||
publisher.debug("{} queue is empty, waiting".format(config_section))
|
publisher.debug("{} queue is empty, waiting".format(config_section))
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
continue
|
continue
|
||||||
|
signal.alarm(60)
|
||||||
Analyse(message, server)
|
try:
|
||||||
|
Analyse(message, server)
|
||||||
|
except TimeoutException:
|
||||||
|
print ("{0} processing timeout".format(message))
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
signal.alarm(0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue