Skip to content
This repository has been archived by the owner on Aug 24, 2024. It is now read-only.

Celery 4+ compatibility #30

Open
vulnersCom opened this issue Feb 25, 2017 · 3 comments
Open

Celery 4+ compatibility #30

vulnersCom opened this issue Feb 25, 2017 · 3 comments

Comments

@vulnersCom
Copy link

Looks like lost :((
I fixed it with modifying this:

def get_from_database(self):
        d = {}
        for doc in PeriodicTask.objects():
            if doc.enabled:
                d[doc.name] = MongoScheduleEntry(doc)
        return d

And remapping tick method:

def tick(self, *args, **kwargs):
        """Run a tick - one iteration of the scheduler.

        Executes one due task per call.

        Returns:
            float: preferred delay in seconds for next call.
        """

        adjust = self.adjust
        intervals = []
        for entry in self.schedule.values():
            is_due, next_time_to_run = self.is_due(entry)
            intervals.append(adjust(next_time_to_run))
            if is_due:
                next_entry = self.reserve(entry)
                self.apply_entry(entry, producer=self.producer)
        return min(intervals + [self.sync_every])
@zakird
Copy link
Member

zakird commented Feb 25, 2017

Would you be willing to submit a PR that fixes this?

@vulnersCom
Copy link
Author

I'm not really sure of that.
It's rapid fix to make it work.

@rafaelreuber
Copy link
Contributor

celerybeat-mongo is compatible with celery 4. I think this issue can be closed, @zakird

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants