aboutsummaryrefslogtreecommitdiff
path: root/rpki/async.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2014-11-19 19:52:54 +0000
committerRob Austein <sra@hactrn.net>2014-11-19 19:52:54 +0000
commit06f6dd3a2ff8ba58c8edfa9ed3d2b12b0b9a7ca4 (patch)
tree6c928941435ae0da88d7400156c5a969751d55ba /rpki/async.py
parentf8316a5c3a72230782f4a1e7d941e627e49ebced (diff)
Add disable_signal_handlers option to rpki.async.sync_wrapper and
rpki.irdb.Zookeeper() to avoid problems when running in environments like mod_wsgi which have strong opinions about what code is and is not allowed to handle signals. This may result in some noise in log files, but there's not much we can do about that if we're not allowed to clean up when terminated, so be it. See #681. svn path=/trunk/; revision=6027
Diffstat (limited to 'rpki/async.py')
-rw-r--r--rpki/async.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/rpki/async.py b/rpki/async.py
index b17c31ed..75b4b656 100644
--- a/rpki/async.py
+++ b/rpki/async.py
@@ -339,8 +339,9 @@ class sync_wrapper(object):
err = None
fin = False
- def __init__(self, func):
+ def __init__(self, func, disable_signal_handlers = False):
self.func = func
+ self.disable_signal_handlers = disable_signal_handlers
def cb(self, res = None):
"""
@@ -374,7 +375,10 @@ class sync_wrapper(object):
self.eb(e)
event_defer(thunk)
- event_loop()
+ if self.disable_signal_handlers:
+ event_loop(catch_signals = ())
+ else:
+ event_loop()
if not self.fin:
logger.warning("%r event_loop terminated without callback or errback", self)
if self.err is None: