From c7ee0178a6c7178f0fbd1218ae602a0cf19cadcc Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sun, 24 Aug 2014 12:15:43 +0300 Subject: [PATCH] cleanup and thumbnail processes are now deferred at startup to improve startup time a bit --- src/cleanup.py | 4 +++- src/thumbnailer.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cleanup.py b/src/cleanup.py index 847c7fa..c51df08 100644 --- a/src/cleanup.py +++ b/src/cleanup.py @@ -30,7 +30,9 @@ _process = None def start(): - _run_process() + # schedule the first call a bit later to improve performance at startup + ioloop = tornado.ioloop.IOLoop.instance() + ioloop.add_timeout(datetime.timedelta(seconds=60), _run_process) def stop(): diff --git a/src/thumbnailer.py b/src/thumbnailer.py index c3b4809..8103784 100644 --- a/src/thumbnailer.py +++ b/src/thumbnailer.py @@ -30,7 +30,9 @@ _process = None def start(): - _run_process() + # schedule the first call a bit later to improve performance at startup + ioloop = tornado.ioloop.IOLoop.instance() + ioloop.add_timeout(datetime.timedelta(seconds=30), _run_process) def stop(): -- 2.39.5