]> www.vanbest.org Git - motioneye-debian/commitdiff
config cache fixes
authorCalin Crisan <ccrisan@gmail.com>
Sat, 12 Oct 2013 16:11:45 +0000 (19:11 +0300)
committerCalin Crisan <ccrisan@gmail.com>
Sat, 12 Oct 2013 16:11:45 +0000 (19:11 +0300)
src/config.py
src/handlers.py

index 3c408d68b9bb7074555ae1dc67a62e7fa702db55..88051643107cdadf76dcf7bb701501c1b7c12384 100644 (file)
@@ -282,9 +282,8 @@ def set_camera(camera_id, data):
 
 
 def add_camera(device_details):
-    global _camera_ids
-    
-    _camera_ids = None
+    global _camera_ids_cache
+    global _camera_config_cache
     
     # determine the last camera id
     camera_ids = get_camera_ids()
@@ -320,13 +319,15 @@ def add_camera(device_details):
     # write the configuration to file
     set_camera(camera_id, data)
     
+    _camera_ids_cache = None
+    _camera_config_cache = None
+    
     return camera_id, data
 
 
 def rem_camera(camera_id):
-    global _camera_ids
-    
-    _camera_ids = None
+    global _camera_ids_cache
+    global _camera_config_cache
     
     camera_config_name = _CAMERA_CONFIG_FILE_NAME % {'id': camera_id}
     camera_config_path = _CAMERA_CONFIG_FILE_PATH % {'id': camera_id}
@@ -342,6 +343,9 @@ def rem_camera(camera_id):
     
     logging.info('removing camera config file %(path)s...' % {'path': camera_config_path})
     
+    _camera_ids_cache = None
+    _camera_config_cache = None
+    
     try:
         os.remove(camera_config_path)
     
index 574125f89d312f382c67b6af24f529612c4a5737..9c757f2edb6002f982bfef0eca2a36c6920bdb41 100644 (file)
@@ -333,7 +333,6 @@ class ConfigHandler(BaseHandler):
             def on_response_builder(camera_id, camera_config):
                 def on_response(remote_ui_config):
                     if remote_ui_config is None:
-                        #length[0] -= 1
                         cameras.append({
                             'id': camera_id,
                             'name': '&lt;error&gt;',