diff options
author | agronholm <devnull@localhost> | 2011-02-06 09:06:29 +0200 |
---|---|---|
committer | agronholm <devnull@localhost> | 2011-02-06 09:06:29 +0200 |
commit | c6c6281628664dcace883f32ab65494f4811b39d (patch) | |
tree | 38f342e0c20fd9b98dc21b7541718631557dbf61 | |
parent | 23872a15603cdb5c1fa4c4e1c22ff16d1425ae47 (diff) | |
download | apscheduler-c6c6281628664dcace883f32ab65494f4811b39d.tar.gz |
Decorators now add the "job" attribute to functions they schedule as jobs; scheduler now adds 1 microsecond to current time when computing next run time for a job to ensure that no job is ever executed twice with the same scheduled time
-rw-r--r-- | apscheduler/scheduler.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/apscheduler/scheduler.py b/apscheduler/scheduler.py index cdd5b68..1e41f8c 100644 --- a/apscheduler/scheduler.py +++ b/apscheduler/scheduler.py @@ -315,7 +315,7 @@ class Scheduler(object): See :meth:`add_cron_job` for more information. """ def inner(func): - self.add_cron_job(func, **options) + func.job = self.add_cron_job(func, **options) return func return inner @@ -328,7 +328,7 @@ class Scheduler(object): See :meth:`add_delayed_job` for more information. """ def inner(func): - self.add_interval_job(func, **options) + func.job = self.add_interval_job(func, **options) return func return inner @@ -422,7 +422,7 @@ class Scheduler(object): run_time = job.next_run_time if run_time <= now: job.runs += 1 - job.compute_next_run_time(now) + job.compute_next_run_time(now + timedelta(microseconds=1)) self._threadpool.submit(self._run_job, job, run_time) # Update the job, but don't keep finished jobs around |