Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions django_cron/backends/lock/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,7 @@ def lock(self):
"""
This method sets a cache variable to mark current job as "already running".
"""
if self.cache.get(self.lock_name):
return False
else:
self.cache.set(self.lock_name, timezone.now(), self.timeout)
return True
return self.cache.add(self.lock_name, timezone.now(), self.timeout)

def release(self):
self.cache.delete(self.lock_name)
Expand Down