From: Calin Crisan Date: Sat, 25 Mar 2017 20:15:39 +0000 (+0200) Subject: start platform update asynchronously X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=619016c3bcddd8f64dc4c9f6ffb3727a6aba7869;p=motioneye-debian start platform update asynchronously --- 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) +