Commits

uniqx committed c9f5dc3

removed blocking sleep from main loop.

Comments (0)

Files changed (1)

 
   # main loop
 
+  last_tick = time.time()
   running = True
   while running:
 
-    for handle in observe_handles:
-      __check_file(handle)
+    # calculate delta time since since last tick
+    d = time.time() - last_tick
 
-    time.sleep(interval)
+    # check files
+    if d >= interval:
 
+      for handle in observe_handles:
+        __check_file(handle)
 
+      last_tick = time.time()
 
+    # sleep ...
+    time.sleep(0)
 
 
 
 
 
 
+
+