Conversation
Refactors daemon purge handling to return errors, purge database data before irreversible transcript deletion, and add bounded polling with timeout/backoff when waiting on logarchiver status. Improves failure reporting by surfacing detailed per-object errors and fixes context usage for guild checks. Also updates main loop cleanup so one-shot runs flush Sentry/loggers before exit, and bumps TicketsBot cloud dependencies (with local common/database replaces enabled).
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.
Description
The guild purge has been failing against the current schema; the fix itself is in TicketsBot-cloud/database#41.
purgeGuildreturnserrorinstead ofbool. Six distinct failure causes collapsed into one boolean, and the caller re-logged what the callee had already logged, so a single failed purge produced two errors that read as two separate faults.context.WithTimeout(..., 5*time.Minute)and thectx.Err()guard, leaving the status loop with no attempt cap and no deadline. Also capped the backoff, which grew without bound.isBotInServerno longer rebuilds its context fromcontext.Background(), so it honours caller cancellation.sentry.Flushbefore exit. InONESHOTmode the process returned frommainimmediately afterRun(), dropping exactly the buffered errors you would be trying to read.Run's only fatal path usedlog.Printf, so a failure to fetch the guild list never reached Sentry. Now uses zap.RetentionPeriod, left at 28 days to match current behaviour. cf92174's title says 30, so that may be worth settling separately — changing it shifts data retention.THIS PR REQIRES TicketsBot-cloud/database#41 and TicketsBot-cloud/logarchiver#10 TO BE ACCEPTED FIRST
THE DATABASE AND THE ARCHIVERCLIENT (and maybe common too) NEEDS TO BE BUMPED IN HERE BEFORE THIS SHOULD GET ACCEPTED
Type of Change
Testing
Tables should be cleaned up now
Checklist