]> www.vanbest.org Git - motioneye-debian/commitdiff
start platform update asynchronously
authorCalin Crisan <ccrisan@gmail.com>
Sat, 25 Mar 2017 20:15:39 +0000 (22:15 +0200)
committerCalin Crisan <ccrisan@gmail.com>
Sat, 25 Mar 2017 20:15:39 +0000 (22:15 +0200)
motioneye/update.py

index 88a67d62e0d338e84324829864a73724d118ae9d..a3ceacdfcf9db3493333e1c306aebfbee0b9bf74 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 
+import datetime
 import logging
 import re
 import subprocess
 
+from tornado import ioloop
+
 
 def get_os_version():
     try:
@@ -110,6 +113,12 @@ def perform_update(version):
         import platformupdate
 
     except ImportError:
-        logging.error('updating is not implemented')
-    
-    platformupdate.perform_update(version)
+        logging.error('updating is not available on this platform')
+        
+        raise Exception('updating is not available on this platform')
+
+    # schedule the actual update for two seconds later,
+    # since we want to be able to respond to the request right away
+    ioloop.IOLoop.instance().add_timeout(datetime.timedelta(seconds=2),
+                                         platformupdate.perform_update, version=version)
+