Tivix / django-cron

Write cron business logic as a Python class and let this app do the rest! It enables Django projects to schedule cron tasks, tracks their success / failures, manages contention (via a cache) etc. Basically takes care of all the boring work for you :-)
www.tivix.com
MIT License
900 stars 193 forks source link

Cache backend locking - error with failure at redis (probably) replication. #136

Closed kregoslup closed 6 years ago

kregoslup commented 6 years ago

Suppose we have Redis with a master-slave replication and we are using redis as backend for locking. Because redis does not support consistency out of the box there is no guarantee that here https://github.com/Tivix/django-cron/blob/master/django_cron/backends/lock/cache.py#L89

def get_running_lock_date(self):
        date = self.cache.get(self.lock_name)  # <---
        if not timezone.is_aware(date):
            tz = timezone.get_current_timezone()
            date = timezone.make_aware(date, tz)
        return date

the date that was taken from cache will be in a format suitable for datetime parser. What do you think about that?

agronick commented 6 years ago

Every day I'm getting failed crons with this issue. I guess the crons finish up between the first and second check.

agronick commented 6 years ago

Theres 11 unmerged merge requests. Last change was a year ago. I think this project is abandoned.

PawelMorawian commented 6 years ago

Is someone willing to take it over ?

kregoslup commented 6 years ago

Resolved here: https://github.com/Tivix/django-cron/pull/130/files