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

Set the redis lock expire time according to the ETA countdown if "default_timeout" is not given #127

Open
Ed-XCF opened this issue Mar 16, 2021 · 0 comments

Comments

@Ed-XCF
Copy link

Ed-XCF commented Mar 16, 2021

Set the redis lock expire time according to the ETA countdown if "default_timeout" is not given
Change in celery_once.tasks.py:QueueOnce.apply_async

once_timeout = (
    once_options.get('timeout')
    or self.once.get('timeout')
    or self.default_timeout
    or self.calc_timeout(options)
    or 60 * 60
)

calc_timeout code example

@staticmethod
def calc_timeout(options):
    countdown, eta = options.get("countdown"), options.get("eta")
    if countdown:
        return countdown
    elif eta:
        return localize(eta, timezone.utc)
@Ed-XCF Ed-XCF changed the title support calc_timeout for once_timeout Set the redis lock expire time according to the ETA countdown if "default_timeout" is not given Mar 16, 2021
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