diff --git a/workers/worker.py b/workers/worker.py index 5b6d6785c..57375f63d 100644 --- a/workers/worker.py +++ b/workers/worker.py @@ -4,6 +4,7 @@ import signal from threading import Event from apscheduler.scheduler import Scheduler +from datetime import datetime, timedelta logger = logging.getLogger(__name__) @@ -49,8 +50,11 @@ class Worker(object): def start(self): logger.debug("Scheduling worker.") + soon = datetime.now() + timedelta(seconds=.001) + self._sched.start() - self._sched.add_interval_job(self.poll_queue, seconds=self._poll_period_seconds) + self._sched.add_interval_job(self.poll_queue, seconds=self._poll_period_seconds, + start_date=soon) self._sched.add_interval_job(self.watchdog, seconds=self._watchdog_period_seconds) signal.signal(signal.SIGTERM, self.join)