aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/rpkid.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2011-04-09 23:02:09 +0000
committerRob Austein <sra@hactrn.net>2011-04-09 23:02:09 +0000
commit3a1da201268815acba8dbb533e91b783dc4335b6 (patch)
tree0157a9426c8b8cc4dfa25c7c0b058b027da0a604 /rpkid/rpki/rpkid.py
parentbe37216c3fc06b6f06933caa6b62b0a83c759a4d (diff)
Don't lock cron out accidently from .serve_run_now()
svn path=/rpkid/rpki/rpkid.py; revision=3768
Diffstat (limited to 'rpkid/rpki/rpkid.py')
-rw-r--r--rpkid/rpki/rpkid.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/rpkid/rpki/rpkid.py b/rpkid/rpki/rpkid.py
index 2781ff96..09f99893 100644
--- a/rpkid/rpki/rpkid.py
+++ b/rpkid/rpki/rpkid.py
@@ -282,7 +282,8 @@ class main(object):
Record that we were still alive when we got here, by resetting
keepalive timer.
"""
- self.cron_timeout = rpki.sundial.now() + self.cron_keepalive
+ if self.cron_timeout is not None:
+ self.cron_timeout = rpki.sundial.now() + self.cron_keepalive
def cron(self, cb = None):
"""
@@ -298,7 +299,7 @@ class main(object):
if self.use_internal_cron:
- if self.cron_timeout and self.cron_timeout < now:
+ if self.cron_timeout is not None and self.cron_timeout < now:
rpki.log.warn("cron keepalive threshold %s has expired, breaking lock" % self.cron_timeout)
self.cron_timeout = None
@@ -306,10 +307,11 @@ class main(object):
rpki.log.debug("Scheduling next cron run at %s" % when)
self.cron_timer.set(when)
- if self.cron_timeout:
+ if self.cron_timeout is not None:
rpki.log.warn("cron already running, keepalive will expire at %s" % self.cron_timeout)
return
+ self.cron_timeout = True
self.checkpoint()
def loop(iterator, s):