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

[feature] Customizable media cleaner schedule #2304

Merged
merged 7 commits into from
Oct 30, 2023

Conversation

tsmethurst
Copy link
Contributor

@tsmethurst tsmethurst commented Oct 26, 2023

Description

If this is a code change, please include a summary of what you've coded, and link to the issue(s) it closes/implements.

If this is a documentation change, please briefly describe what you've changed and why.

This pull request implements customizable start time + interval period for media cleanup jobs.

Adds media-cleanup-from and media-cleanup-every config fields, which keep the current default values of 00:00:00 (midnight) and 86400000000000 or 24h (24 hours).

These fields allow admins to run their cleanup at different times and rates. For example, say one wanted to run a cleanup every 3 days at 4.30am, one could set media-cleanup-from to 04:30:00 and media-cleanup-every to 72h.

To make this work, instantiation of the cleaner has been pushed all the way back to the server process. This is a bit more complex, code-wise, but has the advantage of the scheduler not being run by default when just doing CLI commands and whatnot.

Still a draft because I want to add some documentation for this.

closes #2212

Checklist

Please put an x inside each checkbox to indicate that you've read and followed it: [ ] -> [x]

If this is a documentation change, only the first checkbox must be filled (you can delete the others if you want).

  • I/we have read the GoToSocial contribution guidelines.
  • I/we have discussed the proposed changes already, either in an issue on the repository, or in the Matrix chat.
  • I/we have performed a self-review of added code.
  • I/we have written code that is legible and maintainable by others.
  • I/we have commented the added code, particularly in hard-to-understand areas.
  • I/we have made any necessary changes to documentation.
  • I/we have added tests that cover new code.
  • I/we have run tests and they pass locally with the changes.
  • I/we have run go fmt ./... and golangci-lint run.

@tsmethurst tsmethurst marked this pull request as ready for review October 26, 2023 17:45
# String. 24hr time of day formatted as hh:mm:ss.
# Examples: ["14:30:00", "00:00:00", "04:00:00"]
# Default: "00:00:00" (midnight).
media-cleanup-from: "00:00:00"
Copy link
Member

Choose a reason for hiding this comment

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

I would remove the :ss part. I think it's very unlikely anyone needs to control the start time down to the second.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! Changed here: fe1fe95

@NyaaaWhatsUpDoc NyaaaWhatsUpDoc merged commit 4dc0547 into main Oct 30, 2023
3 checks passed
@NyaaaWhatsUpDoc NyaaaWhatsUpDoc deleted the media_cleaner_customize_schedule branch October 30, 2023 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Make maintenance task time configurable
3 participants