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

Cleaning up preserved jobs giving me timeout #933

Closed
murparreira opened this issue Apr 18, 2023 · 6 comments
Closed

Cleaning up preserved jobs giving me timeout #933

murparreira opened this issue Apr 18, 2023 · 6 comments

Comments

@murparreira
Copy link

Hey guys, thanks for the wonderful gem.
I am getting a timeout on my postgresql database when i run a task for deleting preserved jobs.
Right now we have more than 500k jobs succeeded.

image

This is the code inside the task.

GoodJob.cleanup_preserved_jobs(older_than: 1.days)

Can anyone point me in the right direction here?

image

@bensheldon
Copy link
Owner

@murparreira nuts! Can you tell me what your query timeout is?

I have a PR that I think might help. Would you be willing to try running that? #934

@murparreira
Copy link
Author

murparreira commented Apr 19, 2023

This PR is just what i have implemented here.

image

This code worked and this change is very useful, as many applications uses a very tiny timeout due to performance or infrastructure needs.

@bensheldon
Copy link
Owner

I like the loop. I think that will result in one less query than using Active Record's in_batches.

@murparreira
Copy link
Author

This PR #934, when merged fixes this problem.

@bensheldon
Copy link
Owner

@murparreira thank you for reporting this and the help fixing it! I released the change: https://github.com/bensheldon/good_job/releases/tag/v3.15.2

@murparreira
Copy link
Author

@murparreira thank you for reporting this and the help fixing it! I released the change: https://github.com/bensheldon/good_job/releases/tag/v3.15.2

No problem! Happy to help.

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

No branches or pull requests

2 participants