diff --git a/apscheduler/schedulers/base.py b/apscheduler/schedulers/base.py index 3ce2bfc52..aba723f48 100644 --- a/apscheduler/schedulers/base.py +++ b/apscheduler/schedulers/base.py @@ -1029,6 +1029,7 @@ def _process_jobs(self): wait_seconds = None self._logger.debug('No jobs; waiting until a job is added') else: + now = datetime.now(self.timezone) wait_seconds = min(max(timedelta_seconds(next_wakeup_time - now), 0), TIMEOUT_MAX) self._logger.debug('Next wakeup is due at %s (in %f seconds)', next_wakeup_time, wait_seconds) diff --git a/docs/versionhistory.rst b/docs/versionhistory.rst index ec551e72d..ea0357184 100644 --- a/docs/versionhistory.rst +++ b/docs/versionhistory.rst @@ -12,6 +12,8 @@ UNRELEASED (PR by Ran Benita) * Fixed scheduling class methods like ``B.methodname`` where the ``B`` class inherits from class ``A`` and ``methodname`` is a class method of class ``A`` +* Fixed scheduler sleeping for too long (and thus jobs missing their scheduled run + times) if its wakeup cycle takes too much time (fix by kbasten) 3.10.1