Skip to content

Commit

Permalink
Moved cache lock just after lock check
Browse files Browse the repository at this point in the history
  • Loading branch information
dfryta committed Feb 28, 2013
1 parent 4574f81 commit f790f6d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion django_cron/management/commands/runcrons.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ def run_cron_with_cache_check(cron_class, force=False, silent=False):
@cron_class - cron class to run.
"""
if not cache.get(cron_class.__name__) or getattr(cron_class, 'ALLOW_PARALLEL_RUNS', False):
cache.set(cron_class.__name__, timezone.now(), timeout)
instance = cron_class()
timeout = DEFAULT_LOCK_TIME
try:
timeout = settings.DJANGO_CRON_LOCK_TIME
except:
pass
cache.set(cron_class.__name__, timezone.now(), timeout)
CronJobManager.run(instance, force)
cache.delete(cron_class.__name__)
else:
Expand Down

0 comments on commit f790f6d

Please sign in to comment.