Cleanup detached changesets
Created by: Piszmog
Closes #16122 (closed).
- Created a DB migration to add a new column
detached_at
to thechangesets
table to track when a Changeset becomes detached - Set the
detached_at
value when theReconcilerOperationDetach
is ran - Added a new janitor job (
NewChangesetDetachedCleaner
) to delete Changesets that are "old" (runs every 24 hours)
Test plan
Go unit tests and manual testing.
Manual Testing Steps
- Create a Batch Change
- Apply and Publish the Changeset
- Modify the Batch Spec to where the Changeset will no longer exist
- Rerun spec and Apply the Changes
- Changeset is now Archived/Deleted
- Detach the Changeset
- In the DB, ensure
detached_at
is set - Update
detached_at
to 2 or so weeks out - Wait for the periodic job to cleanup the Changeset (may need to restart the app since runs once a day)