From d72a8e968699e7eba528b1103838f914d9c0ad6a Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Tue, 2 Oct 2012 10:34:15 -0400 Subject: [PATCH] Cleaned up interval handling in ManagerTimeout and left a TODO pointing at further work --- python_apps/media-monitor2/media/monitor/manager.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/python_apps/media-monitor2/media/monitor/manager.py b/python_apps/media-monitor2/media/monitor/manager.py index 00b32548f..77bcf10ec 100644 --- a/python_apps/media-monitor2/media/monitor/manager.py +++ b/python_apps/media-monitor2/media/monitor/manager.py @@ -18,14 +18,16 @@ class ManagerTimeout(threading.Thread,Loggable): secnods. This used to be just a work around for cc-4235 but recently became a permanent solution because it's "cheap" and reliable """ - def __init__(self, manager): + def __init__(self, manager, interval=3): + # TODO : interval should be read from config and passed here instead + # of just using the hard coded value threading.Thread.__init__(self) - self.manager = manager + self.manager = manager + self.interval = interval def run(self): while True: - time.sleep(3) + time.sleep(self.interval) # every 3 seconds self.manager.flush_organize() - #self.logger.info("Force flushed organize...") class Manager(Loggable): """