Small fixes in the event layer for the observer
diff --git a/planetstack/openstack/event_manager.py b/planetstack/openstack/event_manager.py
index 33c6bfb..a849f09 100644
--- a/planetstack/openstack/event_manager.py
+++ b/planetstack/openstack/event_manager.py
@@ -102,13 +102,17 @@
class EventListener:
def __init__(self,wake_up=None):
self.handler = EventHandler()
- self.wake_up = wake_up()
+ self.wake_up = wake_up
def handle_event(self, payload):
payload_dict = json.loads(payload)
- event = payload_dict['event']
- ctx = payload_dict['ctx']
- self.handler.dispatch(event,**ctx)
+
+ # The code below will come back when we optimize the observer syncs
+ # into 'small' and 'big' syncs.
+
+ #event = payload_dict['event']
+ #ctx = payload_dict['ctx']
+ #self.handler.dispatch(event,**ctx)
if (self.wake_up):
self.wake_up()
diff --git a/planetstack/openstack/observer.py b/planetstack/openstack/observer.py
index 9e83f5b..fbacb67 100644
--- a/planetstack/openstack/observer.py
+++ b/planetstack/openstack/observer.py
@@ -8,7 +8,7 @@
from core.models import *
from django.db.models import F, Q
from openstack.manager import OpenStackManager
-from util.logger import Logger, logging
+from util.logger import Logger, logging, logger
#from timeout import timeout
@@ -27,6 +27,7 @@
self.event_cond.release()
def wake_up(self):
+ logger.info('Wake up routine called. Event cond %r'%self.event_cond)
self.event_cond.acquire()
self.event_cond.notify()
self.event_cond.release()
@@ -36,16 +37,18 @@
return
while True:
try:
+ logger.info('Observer run loop')
#self.sync_roles()
+ logger.info('Calling sync tenants')
self.sync_tenants()
self.sync_users()
self.sync_user_tenant_roles()
self.sync_slivers()
self.sync_sliver_ips()
+ logger.info('Calling sync external routes')
self.sync_external_routes()
-
- self.wait_for_event(timeout=30)
-
+ self.wait_for_event(timeout=300)
+ logger.info('Observer woken up')
except:
traceback.print_exc()