Repository navigation
Explain custom purge timing, resume interrupted wipes, and add message lifetimes - #46
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Admins reported custom purge schedules firing early. A
*/15 * * * *schedule wiped 5 minutes after saving, and a daily schedule wiped a few hours after saving.The scheduler is correct. Cron schedules run at fixed times on the UTC clock, not counted from the save. Saving
*/15at :40 fires at :45. A midnight UTC schedule fires at 7 PM Eastern. The panel showed a single "Next wipe" time with no explanation, so the first run looked wrong.What changed
Clearer custom schedules
*/15as the example.GET /api/guilds/:guildID/purges/preview?cron=...Interrupted wipes resume
At startup,
RecoverStuckWorkused to reset running wipes and set them to run again right away. That threw away the saved position and wiped the whole channel again. Running wipes now stay as they are, and the scheduler continues from the saved position.Message lifetime (new)
Pick a channel and a lifetime: 15 minutes, 1 hour, 4 hours, 24 hours, or 7 days. The bot deletes each message that long after it was posted. Messages already in the channel count too.
now - lifetime, so there's no per-message tracking table. Messages posted while the bot was offline get deleted on the next check.023_channel_expiries.sqlPOST /purges/lifetimes,DELETE /purges/lifetimes/:channelIDTest mock
The Discord mock now gives messages time-based IDs, like real Discord. The lifetime sweep depends on this. All existing tests pass with the change.
Testing
go test ./...go test -tags e2e ./e2e, with new tests for the cron preview, resume after restart (fails on the old code), and the lifetime API and sweeps (expired, fresh, older than 14 days, paging, paused, missing channel)Notes
svelte-checkreports one existing error inweb/vite.config.js(missing Node types forprocess). This PR doesn't touch it.