celerybeat-mongo icon indicating copy to clipboard operation
celerybeat-mongo copied to clipboard

Celery 4+ compatibility

Open vulnersCom opened this issue 7 years ago • 3 comments

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])

vulnersCom avatar Feb 25 '17 13:02 vulnersCom

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

zakird avatar Feb 25 '17 19:02 zakird

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

vulnersCom avatar Feb 26 '17 10:02 vulnersCom

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

rafaelreuber avatar May 03 '20 13:05 rafaelreuber