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

Use prefetch_related in DatabaseScheduler.all_as_schedule #608

Closed
jahazieldom opened this issue Nov 30, 2022 · 1 comment
Closed

Use prefetch_related in DatabaseScheduler.all_as_schedule #608

jahazieldom opened this issue Nov 30, 2022 · 1 comment

Comments

@jahazieldom
Copy link
Contributor

Summary:

We use django-celery-beat in a multi-tenant application, we have 20K rows of periodic tasks (each tenant has its own periodic tasks), but when any task is created, updated or deleted the method DatabaseScheduler.all_as_schedule it takes a long time to be processed, i think you could use self.Model.objects.enabled().prefetch_related("interval", "crontab", "solar", "clocked") and with that it significantly reduces the processing time.

The problem we are having is that many periodic tasks are not executed in due time.

Versions

celery==5.2.7
django-celery-beat==2.4.0

@auvipy
Copy link
Member

auvipy commented Nov 30, 2022

I thinkk we should consider this for all the models that will be benefited from prefetch_related

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

2 participants