]> www.vanbest.org Git - motioneye-debian/commitdiff
motion respawning mechanism is now inhibited after ioloop stop
authorCalin Crisan <ccrisan@gmail.com>
Sat, 19 Oct 2013 09:56:04 +0000 (12:56 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sat, 19 Oct 2013 09:56:04 +0000 (12:56 +0300)
doc/todo.txt
motioneye.py

index 03655acf36580d7f9095c420be0c0b8e1092d8ab..13f1dc4e8ea31e2d5fe33e9538a2860f2f715e99 100644 (file)
@@ -4,7 +4,6 @@
 -> http clients don't die: max_clients limit reached, request queued. 10 active, 217 queued requests. 
 -> remote adding ui could be improved (cleanup fields on ok/on load, no error message until everything is ok)
 
--> kill the motion respawning mechanism on sigint
 -> add an autoupdate mechanism
 
 -> style scroll bars
index adb4c7e3ff7849c28d1cf59d44cd876e1215eea4..381d124a7207946b8ee6583ad96004dfb8188b1f 100755 (executable)
@@ -141,11 +141,14 @@ def _start_motion():
 
     # add a motion running checker
     def checker():
+        ioloop = tornado.ioloop.IOLoop.instance()
+        if not ioloop.running(): # just stopped
+            return
+        
         if not motionctl.running() and config.has_enabled_cameras():
             motionctl.start()
             logging.info('motion started')
 
-        ioloop = tornado.ioloop.IOLoop.instance()
         ioloop.add_timeout(datetime.timedelta(seconds=settings.MOTION_CHECK_INTERVAL), checker)
     
     checker()
@@ -155,6 +158,10 @@ def _start_cleanup():
     import cleanup
 
     def do_cleanup():
+        ioloop = tornado.ioloop.IOLoop.instance()
+        if not ioloop.running(): # just stopped
+            return
+
         try:
             cleanup.cleanup_images()
             cleanup.cleanup_movies()
@@ -163,7 +170,6 @@ def _start_cleanup():
             logging.error('failed to cleanup media files: %(msg)s' % {
                     'msg': unicode(e)})
 
-        ioloop = tornado.ioloop.IOLoop.instance()
         ioloop.add_timeout(datetime.timedelta(seconds=settings.CLEANUP_INTERVAL), do_cleanup)
 
     do_cleanup()