Repository navigation
fix: respond to date and vote changes before refreshing Discord - #11
Merged
Merged
Conversation
Confirming, cancelling, or voting edited the Discord timetable message inside the request. Discord limits message edits per channel, so rapid clicks queued behind its rate limiter and each request waited seconds. Changes now commit to PostgreSQL and respond immediately; the message is refreshed in the background, and changes within 750 ms are merged into one edit that renders the latest database state.
A background refresh lost to a crash or restart left the Discord message stale until the next change. On startup the scheduler now queues a refresh for every published, open poll, rebuilding each message from PostgreSQL.
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.
Summary
pollRefresherupdates the Discord message in the background.Store.PublishedOpenPollIDs. A refresh lost to a crash or restart is repaired within a second of coming back up.v0.0.11.Verification
TestPollRefresherCoalescesBursts: five rapid queues on one poll give one refresh, other polls refresh independently, and a later change triggers another refresh.TestPublishedOpenPollIDs: lists only open polls with a Discord message, excluding unpublished and closed ones.go test ./...withTEST_DATABASE_URL(PostgreSQL 16),go test -race ./internal/discord,go vet ./....