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

Discrepancy in README about preserve_job_records? #1265

Open
marckohlbrugge opened this issue Feb 28, 2024 · 2 comments
Open

Discrepancy in README about preserve_job_records? #1265

marckohlbrugge opened this issue Feb 28, 2024 · 2 comments

Comments

@marckohlbrugge
Copy link
Contributor

marckohlbrugge commented Feb 28, 2024

preserve_job_records is enabled by default:

- `preserve_job_records` (boolean) keeps job records in your database even after jobs are completed. (Default: `true`)

but here it says "By default, GoodJob automatically destroys job records":

good_job/README.md

Lines 221 to 222 in 3933005

By default, GoodJob automatically destroys job records when the job is performed
and this command is not required to be used.

Am I misunderstanding, or are those two conflicting statements?

It seems that by default jobs are preserved for 14 days, but only if you run good_job cleanup_preserved_jobs will it actually clear out these older jobs. If that's the case, then I think the README should be clearer about the need for running good_job cleanup_preserved_jobs.

Also, a pre-existing GoodJob::CleanupPreservedJobsJob we can use with the cron feature would be handy for this.

@bensheldon
Copy link
Owner

You're right that sentence doesn't give the full picture. A more accurate statement would be something like.

"By default, GoodJob retains finished job records for 14 days and then automatically deletes them."

The setting that is used immediately after a job finishes to determine what to do is:

  • preserve_job_records

And then the settings related to how the jobs are automatically cleaned up are:

  • cleanup_discarded_jobs
  • cleanup_preserved_jobs_before_seconds_ago (I'm still looking for a better name for this)
  • cleanup_interval_jobs
  • cleanup_interval_seconds

Looking at the Readme, it probably looks like jobs need to be manually cleaned up because it documents the manual action of the CLI before getting to the configuration values (and I think the manual action did exist before the automatic part was added) and this section:

https://github.com/bensheldon/good_job?tab=readme-ov-file#monitor-and-preserve-worked-jobs

@marckohlbrugge
Copy link
Contributor Author

I see! Thanks for the clarification.

It might be worth giving this feature a self-explanatory name such as "auto cleanup". Just some (AI-generated) ideas:

  • preserve_job_recordsretain_job_records_on_completion : Keeps job records in your database even after jobs are completed.
  • cleanup_discarded_jobs → auto_cleanup_discarded_jobs: Automatically deletes discarded job records consistently, controlled by auto_cleanup_interval_jobs and auto_cleanup_interval_seconds.
  • cleanup_preserved_jobs_before_seconds_ago → auto_cleanup_retention_period: Specifies the duration for which a job record should be retained before being automatically cleaned up.
  • cleanup_interval_jobs → auto_cleanup_interval_jobs: Determines the interval (count of jobs done) after which the cleanup operation is initiated.
  • cleanup_interval_seconds → auto_cleanup_interval_seconds: Determines the timeframe (in seconds) after which the cleanup operation is initiated.

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

No branches or pull requests

2 participants