GoodJob.cleanup_preserved_jobs: add :include_discarded option #1550
+16
−2
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.
This change allows the caller of
GoodJob.cleanup_preserved_jobs
to specify the:include_discarded
option, rather than always relying on the value that is set in the configuration.This would enable us to e.g. set
config.cleanup_preserved_jobs_before_seconds_ago
to a very low value (e.g. 10 seconds), but also setconfig.cleanup_discarded_jobs = false
so that we can retain discarded jobs for longer in case we want to inspect them or manually retry then.We would then set up a separate maintenance job to call
GoodJob.cleanup_preserved_jobs(older_than: some_longer_period, include_discarded: true)
.