let waiting for the event consume some of the 5 minute delay
diff --git a/planetstack/openstack/observer.py b/planetstack/openstack/observer.py
index 037c1c5..0e8b47d 100644
--- a/planetstack/openstack/observer.py
+++ b/planetstack/openstack/observer.py
@@ -90,8 +90,15 @@
traceback.print_exc()
logger.info('Waiting for event')
+ tBeforeWait = time.time()
self.wait_for_event(timeout=300)
- time.sleep(300)
+
+ # Enforce 5 minutes between wakeups
+ tSleep = 300 - (time.time() - tBeforeWait)
+ if tSleep > 0:
+ logger.info('Sleeping for %d seconds' % tSleep)
+ time.sleep(300)
+
logger.info('Observer woken up')
except:
logger.log_exc("Exception in observer run loop")