Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DJANGO_CELERY_BEAT_TZ_AWARE conflicts with setting beat_cron_starting_deadline of celery #809

Open
cy9747 opened this issue Sep 26, 2024 · 1 comment

Comments

@cy9747
Copy link

cy9747 commented Sep 26, 2024

Summary:

beat_cron_starting_deadline is a celery configuration variable.

beat_cron_starting_deadline is used in the is_due function of the crontab class, which celery beat's class TzAwareCrontab inherits from, but overwrites is_due so that this setting does not work.

  • Celery Version: 5.4.0
  • Celery-Beat Version: 2.7.0

Exact steps to reproduce the issue:

  1. set beat_cron_starting_deadline = 300
  2. set DJANGO_CELERY_BEAT_TZ_AWARE = True
  3. beat_cron_starting_deadline not work
@cy9747 cy9747 changed the title DJANGO_CELERY_BEAT_TZ_AWARE conflicts with setting beat_cron_starting_deadline or celery DJANGO_CELERY_BEAT_TZ_AWARE conflicts with setting beat_cron_starting_deadline of celery Sep 26, 2024
@cy9747
Copy link
Author

cy9747 commented Sep 26, 2024

Is it a good idea to use super?

before

def is_due(self, last_run_at):
        last_run_at = last_run_at.astimezone(self.tz)

        rem_delta = self.remaining_estimate(last_run_at)
        rem = max(rem_delta.total_seconds(), 0)
        due = rem == 0
        if due:
            rem_delta = self.remaining_estimate(self.now())
            rem = max(rem_delta.total_seconds(), 0)
        return schedstate(due, rem)

after

def is_due(self, last_run_at):
    last_run_at = last_run_at.astimezone(self.tz)

    return super().is_due(last_run_at)

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

No branches or pull requests

1 participant