Skip to content

Commit

Permalink
Merge pull request #110 from Kuznitsin/master
Browse files Browse the repository at this point in the history
py3k fixes
  • Loading branch information
maxim-kht authored Jun 5, 2018
2 parents 01cbb6f + 4b9c273 commit cc6579f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions django_cron/backends/lock/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def lock(self):
lock_name = self.get_lock_name()
# need loop to avoid races on file unlinking
while True:
f = open(lock_name, 'w+', 0)
f = open(lock_name, 'wb+', 0)
locks.lock(f, locks.LOCK_EX | locks.LOCK_NB)
# Here is the Race:
# Previous process "A" is still running. Process "B" opens
Expand All @@ -34,7 +34,7 @@ def lock(self):
st1 = os.fstat(f.fileno())
st2 = os.stat(lock_name)
if st1.st_ino == st2.st_ino:
f.write(str(os.getpid()))
f.write(bytes(os.getpid()))
self.lockfile = f
return True
# else:
Expand Down

0 comments on commit cc6579f

Please sign in to comment.