Skip to content

Build: separate delete-snapshots from process-repos #1105

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

xbhouse
Copy link
Contributor

@xbhouse xbhouse commented May 7, 2025

Summary

Separates the snapshot-cleanup job from process-repos so it can be run on its own schedule (this sets it to run daily). This may also help narrow down and reduce the errors being reported by glitchtip (https://issues.redhat.com/browse/HMS-5947)

Testing steps

  1. Create a repo, let it snapshot, then edit the repo URL to get another snapshot
  2. Adjust the date of one of the snapshots to be a year old: UPDATE snapshots SET created_at = (NOW() - CAST('365 days' AS INTERVAL)) WHERE uuid = '<snapshot_uuid>';
  3. Run go run cmd/external-repos/main.go process-repos. You shouldn't see any delete-snapshots tasks enqueued
  4. Run go run cmd/external-repos/main.go snapshot-cleanup. This should start the delete-snapshots task

@xbhouse xbhouse marked this pull request as ready for review May 8, 2025 21:58
@rverdile rverdile self-assigned this May 12, 2025
@@ -875,6 +875,87 @@ objects:
name: content-sources-candlepin
key: key
optional: true
- name: snapshot-cleanup
schedule: "0 1 * * *"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would make sense to define a DAILY_CRON_JOB value for this, kinda like weekly

Comment on lines 1143 to 1146
description: whether to not run the daily job to delete outdated snapshots
required: false
value: "false"
Copy link
Contributor

Choose a reason for hiding this comment

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

this is unused, and looks like the new job is using SUSPEND_CRON_JOB instead. I'm guessing this can just be removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oops :) meant to update that value but yes just using the existing param is better!

Copy link
Contributor

@rverdile rverdile left a comment

Choose a reason for hiding this comment

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

looks good!

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.

2 participants