Async#32
Open
solitaryurt wants to merge 7 commits into
Open
Conversation
- Add AsyncConfig with a 50-thread pool executor for Discord commands - Annotate recvMessage, recvInteraction, and handleInteraction with @async - Parallelize Server pings and RCON calls in !showservers - Optimize db.loadMatch to eliminate O(N) blocking Discord API lookups - Enable PRAGMA journal_mode=WAL on SQLite connection to prevent DB locks - Remove synchronized keyword from FtwglApi to allow parallel HTTP calls
…ecution - Spring AOP proxying for @async was failing to intercept PickupBot - Injected commandExecutor directly into PickupBot and CommandInitService - Wrapped recvMessage, recvInteraction, and handleInteraction bodies in commandExecutor.execute() to ensure Discord commands never block JDA threads
…o preserve ordering - Add a dedicated single-threaded queueExecutor for commands that modify game state (add/remove/pick/map/surrender/team etc) so they execute in FIFO order, ensuring fairness for players - Read-only commands (status/last/elo/live/help/showservers etc) still use the multi-threaded commandExecutor so they respond instantly - Determine executor at dispatch time before entering the lambda, so the switch statement logic is completely unchanged - Apply same pattern to button interactions (pick/teaminvite go through queueExecutor, stats/season views go through commandExecutor)
- Add @PreDestroy hook to PickupBot that calls db.disconnect() on shutdown - Database.disconnect() now runs PRAGMA wal_checkpoint(TRUNCATE) before closing the connection, flushing all WAL data to the main DB file - Configure both executors with setWaitForTasksToCompleteOnShutdown(true) and 30s termination timeout so in-flight commands finish before the database connection is closed
- Remove unused @EnableAsync and @async imports (not needed with manual executor.execute()) - Replace inline FQCNs with proper imports for readability - Route slash commands through queueExecutor to prevent race conditions on shared state - Extract MatchSummary data class so Database layer returns plain data instead of DiscordEmbed - Move Discord embed formatting into PickupLogic.buildMatchEmbed()
2f51e33 to
9119e56
Compare
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.
No description provided.