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

Implement GoodJob.cleanup_preserved_jobs, fixes #351 #356

Conversation

aried3r
Copy link
Contributor

@aried3r aried3r commented Aug 30, 2021

No description provided.

@aried3r aried3r force-pushed the ar/implement_good_job_cleanup_preserved_jobs branch from 38fb393 to 23ff392 Compare August 30, 2021 13:40
Copy link
Owner

@bensheldon bensheldon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! 👍 I had a non-blocking question about the kwarg name, but I really appreciate this. Let me know if you want to noodle over the kwarg name, or we can defer and I can merge as-is.

lib/good_job.rb Outdated
# delete old records and preserve space in your database.
# @params before_seconds_ago [nil,Numeric] Jobs olders than this will be deleted (default: +86400+).
# @return [Integer] Number of jobs that were deleted.
def self.cleanup_preserved_jobs(before_seconds_ago: nil)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if you think it would be good to have a better kwarg name here. I want to suggest something like

  • cleanup_preserved_jobs(before: 3.days.ago) or
  • cleanup_preserved_jobs(older_than: 3.days) <-- I think I like this one.
  • Something better?

The longer option names were really a result of wanting the CLI interface to be clear given that there are limitations in what can be passed through ENV. But as a Ruby method, it's easy to pass in a timestamp, or duration.

It's a kwarg so it's trivial to preserve both options, and there is a benefit to being symetrical with the CLI options, but I recognize it's a little clunky.

Not a blocker of this PR, I wanted to get your perspective :D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious if you think it would be good to have a better kwarg name here.

Definitely!

When writing this, I was also considering older_than but wanted to stick with the CLI option name to avoid having to discuss a potential other name. So I'm very happy you brought it up!

I don't think we necessarily need to keep both names, but I'm open to that. I'll work on the changes and you can have another look if you want to keep this symmetrical after all.

@aried3r aried3r force-pushed the ar/implement_good_job_cleanup_preserved_jobs branch from 113b979 to daf8e83 Compare August 30, 2021 18:59
README.md Outdated Show resolved Hide resolved
Co-authored-by: Ben Sheldon [he/him] <[email protected]>
@bensheldon bensheldon merged commit f796741 into bensheldon:main Aug 31, 2021
@bensheldon
Copy link
Owner

@aried3r Thank you! 🎉 Released inv2.0.3.

@bensheldon bensheldon added the enhancement New feature or request label Aug 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants