Repository navigation
add job_broadcaster to apply bot bans and post to discord - #260
Merged
Merged
Conversation
added 5 commits
November 11, 2026 01:45
- new ban_broadcast and discord_webhook components; counts, selection, and confirmed_ban update run in one transaction - embeds post over aiohttp webhook with 429 retry; errors returned as values - adds job-broadcaster mysql user/grants, compose services, CI workflow, grafana panel, and tests
- retry the snapshot and each apply batch on transient db errors (lock waits, deadlocks, lost connections) with exponential backoff - apply bans in id batches, one short transaction per batch, single table PK updates - no join, no json evaluation in the update - lower session innodb_lock_wait_timeout so lock waits fail fast - read pages stream by id cursor instead of one big result set - emit a wide event per run via the wide_event component - add idx_ban_labels on Players for the pending-ban scan
one loop: apply chunk -> post chunk's names embed. the apply batching now shares chunk_size with the embeds, so the discord pacing throttles the update rate too, and applied bans are announced incrementally. totals embed posts before the loop; DB_UPDATE_BATCH_SIZE is gone.
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
job_broadcastercronjob (base, project, Dockerfile, CI workflow) that applies predicted bot bans (confirmed_ban = 1) and announces results to the graveyard Discord channeldatabase/ban_broadcastcomponent: counts pending bans, selects predicted bots (Real_Playerprobability < 0.5), and applies bans in one transaction so announced counts/names match the UPDATE; a symmetry test enforces the SELECT and UPDATE predicates stay in syncdiscord_webhookcomponent: async aiohttp poster that returns errors as values (no abort mid-broadcast), honors 429retry_afterwith uniform retries on every post, and validates Discord embed size limits at construction.env.exampleentries (GRAVEYARD_WEBHOOKrequired,GRAVEYARD_ROLE_MENTIONoptional)Testing
uv run pytest: 494 passed, including 41 new tests coveringjob_broadcaster,discord_webhook, anddatabase/ban_broadcasttest_repository.py::test_select_and_apply_predicates_are_symmetricguards SELECT/UPDATE predicate driftuv run mypy: no issues founduv run ruff format --check .anduv run ruff check .: cleanworkflow_dispatch