From 619016c3bcddd8f64dc4c9f6ffb3727a6aba7869 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 25 Mar 2017 22:15:39 +0200 Subject: [PATCH] start platform update asynchronously --- motioneye/update.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/motioneye/update.py b/motioneye/update.py index 88a67d6..a3ceacd 100644 --- a/motioneye/update.py +++ b/motioneye/update.py @@ -15,10 +15,13 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +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) + -- 2.39.5