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

Upgrade good_job to its latest version #17887

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

mereghost
Copy link
Contributor

Following up on #17327 this updates GoodJob to its latest 4.x release.

@mereghost mereghost added DO NOT MERGE dependencies Pull requests that update a dependency file labels Feb 10, 2025
@mereghost mereghost requested a review from machisuji February 10, 2025 18:43
@mereghost mereghost self-assigned this Feb 10, 2025
@klaustopher
Copy link
Contributor

klaustopher commented Feb 11, 2025

Should we make the v4 check (GoodJob.v4_ready?) somehow part of our upgrade script so that we ensure all jobs have been properly processed before this gem update?

@mereghost
Copy link
Contributor Author

@klaustopher probably. For that we might need @machisuji to have a proper discussion.

@mereghost mereghost force-pushed the dependencies/good_job-upgrade branch from 9c0ce95 to 09cf39c Compare February 11, 2025 13:43
@machisuji
Copy link
Member

@klaustopher @mereghost I'm not sure how the v4 check would work and how we can make sure all current jobs have been processed before the upgrade. Is that even necessary? Perhaps we can talk about this in person. I'll be off until next week, Tuesday, though!

@mereghost
Copy link
Contributor Author

Perhaps we can talk about this in person. I'll be off until next week, Tuesday, though!

Let's talk then. While important, this can wait a week. I'll try to find a time for us to talk about it.

@klaustopher
Copy link
Contributor

With v4 goodjob has split jobs and job executions into 2 tables, previously everything was handled in one table and that lead to weird locking situations, etc. So they split it up. With the latest 3.x versions they have already done the split but were loading jobs from both tables. The GoodJob.v4_ready? is implemented as:

    GoodJob.migrated? && # ensures all goodjob migrations are present
    GoodJob::Job.discrete_support? && # ensures the table for discrete executions exists
    GoodJob::Job.where(finished_at: nil).where(is_discrete: [nil, false]).none? # ensures there's no more jobs that are not discrete that are not finished yet

Alternatively we can also determine this via an SQL query

SELECT COUNT(*) FROM "good_jobs" WHERE finished_at IS NULL AND is_discrete IS NOT TRUE

This should return 0 for all databases. If this is true we can savely migrate to 4.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file DO NOT MERGE
Development

Successfully merging this pull request may close these issues.

3 participants