From: Stephen Gran Date: Sat, 25 Jan 2014 14:40:40 +0000 (+0000) Subject: a little defensiveness X-Git-Tag: userdir-ldap-0.3.85~19 X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fuserdir-ldap.git;a=commitdiff_plain;h=3f6b23ba5bdc2a7ce53fdac291bc85843bc8e84f a little defensiveness Signed-off-by: Stephen Gran --- diff --git a/ud-replicated b/ud-replicated index 1e19ef4..bb4fa37 100755 --- a/ud-replicated +++ b/ud-replicated @@ -76,8 +76,8 @@ last_run = 0 def do_replicate(message): global last_run last_update = int(time.time()) - LOG.debug("Got message at %s: %s" % (last_update, message['message'])) - if last_run > message.get('timestamp', 0): + LOG.debug("Got message at %s: %s" % (last_update, message.get('message', message))) + if last_run > message.get('timestamp', last_update): return command = ['/usr/bin/ud-replicate'] @@ -94,7 +94,7 @@ def do_replicate(message): LOG.debug('%s finished with ret: 0' % ' '.join(command)) finally: os.environ['TERM'] = old_term - last_run = int(time.time()) + last_run = last_update def main(): conn = Connection(conf=mq_conf)