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

hotfix - add a delay for adding time spent #996

Merged
merged 2 commits into from
Mar 8, 2024
Merged

Conversation

shapiromatron
Copy link
Owner

Add a 10s delay for adding time spent to ensure existing rows have been created and foreign key relations will be valid. This uses countdown to schedule 10 seconds in the future.

Using countdown with a redis broker does have a warning in the celery docs:

Tasks with eta or countdown are immediately fetched by the worker and until the scheduled time passes, they reside in the worker’s memory. When using those options to schedule lots of tasks for a distant future, those tasks may accumulate in the worker and make a significant impact on the RAM usage.

Moreover, tasks are not acknowledged until the worker starts executing them. If using Redis as a broker, task will get redelivered when countdown exceeds visibility_timeout (see Caveats).

We're using a visbility_timeout of 1hr w/ redis (default), so it seems unlikely that an additional 10s wait will make it too close (https://docs.celeryq.dev/en/stable/getting-started/backends-and-brokers/redis.html#visibility-timeout).

Copy link
Collaborator

@munnsmunns munnsmunns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! It makes sense that we shouldn't have any impact from those caveats, since tasks are only existing in ram for an extra 10s

@shapiromatron shapiromatron merged commit 81a63ce into main Mar 8, 2024
6 checks passed
@shapiromatron shapiromatron deleted the delay-time-spent branch March 8, 2024 00:55
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

Successfully merging this pull request may close these issues.

2 participants