-
-
Notifications
You must be signed in to change notification settings - Fork 208
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
Create "discrete" good_job_executions
table to separate Job records from Execution records and have a 1-to-1 correspondence between good_jobs
records and Active Job jobs
#928
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
230975e
to
e4811a1
Compare
… from Execution records
e4811a1
to
37962da
Compare
Benchmarking this seems very inconsequential, despite the additional transactions and inserts: ❯ ruby scripts/benchmark_discrete_jobs.rb
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
Warming up --------------------------------------
discrete jobs and no errors
4.000 i/100ms
undiscrete jobs and no errors
4.000 i/100ms
discrete jobs and 5 errors
4.000 i/100ms
undiscrete jobs and 5 errors
4.000 i/100ms
Calculating -------------------------------------
discrete jobs and no errors
47.279 (± 6.3%) i/s - 236.000 in 5.007317s
undiscrete jobs and no errors
47.613 (± 4.2%) i/s - 240.000 in 5.052548s
discrete jobs and 5 errors
48.203 (±12.4%) i/s - 240.000 in 5.044026s
undiscrete jobs and 5 errors
45.840 (± 6.5%) i/s - 232.000 in 5.080429s
Comparison:
discrete jobs and 5 errors: 48.2 i/s
undiscrete jobs and no errors: 47.6 i/s - same-ish: difference falls within error
discrete jobs and no errors: 47.3 i/s - same-ish: difference falls within error
undiscrete jobs and 5 errors: 45.8 i/s - same-ish: difference falls within error |
# Conflicts: # lib/good_job.rb
good_job_executions
table to separate Job records from Execution recordsgood_job_executions
table to separate Job records from Execution records and have a 1-to-1 correspondence between good_jobs
records and Active Job jobs
cd453dc
to
ece73e0
Compare
grncdr
added a commit
to grncdr/good_job
that referenced
this pull request
Jan 3, 2024
This variable is a GoodJob::DiscreteExecution except in cases where migrations have not been run in a long time. That case didn't seem worthy of cluttering up the comment. See: bensheldon#928
This was referenced Feb 11, 2024
bensheldon
added a commit
that referenced
this pull request
Feb 22, 2024
* Add extension partials to good_job/jobs#show view * Install empty extension partials in good_job:install * Update README section about extending dashboard views * Fix lint error * Add view extension example and system spec * Correct class name in default custom partial This variable is a GoodJob::DiscreteExecution except in cases where migrations have not been run in a long time. That case didn't seem worthy of cluttering up the comment. See: #928 * Remove generators and move partials to `app/views/good_job` * Add system test and move demo partials to proper place --------- Co-authored-by: Ben Sheldon [he/him] <bensheldon@gmail.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On the path to #831, which requires having a single row per job to lock, whereas currently GoodJob overloads a single table to contain both Execution and Job records, which leads to multiple rows with the same
active_job_id
.This PR provides a backwards-compatible/minor-releasable change by adding a new
good_job_executions
table corresponding toGoodJob::DiscreteExecutions
model, along with a booleanis_discrete
column on Jobs/Executions. Once the migration is run, subsequently created jobs will bediscrete
, and they will use the new table. Old, non-discrete jobs will continue to run with multiple executions.discrete
Job records are updated in place with the most recent attributes after retries. DiscreteExecutions/good_job_executions
are used to track historical changes in job attributes (#271)Because
is_discrete
is a nice boolean for adding in additional behavior, a few other minor changes:id
is the same as theactive_job_id
. This is a nice alignment with Active Job.scheduled_at
value. If it is not actually scheduled for the future, it should be identical to thecreated_at
value. This should help make the fetch-and-lock query a little simpler while still being able to differentiate between jobs that are intended to run immediately or are actually scheduled.When this gets to the
v3.99
release, it will be necessary to ensure that all unfinished jobs arediscrete
so thatv4.0
can safely remove the backwards compatible code-paths. I'm imagining some kind of "Healthcheck" to peep that out, but that's not implemented here.serialized_params
, which is necessary becauseDiscreteExecutions
are not created until the job is performed, which is different currently thanExecutions
.