Commit Graph

19 Commits

Author SHA1 Message Date
Cal Corum
90d7345850 Implement play locking to prevent concurrent command processing
Adds idempotency guard to prevent race conditions when multiple users
submit commands for the same play simultaneously.

Changes:
- Add PlayLockedException for locked play detection
- Implement lock check in checks_log_interaction()
- Acquire lock (play.locked = True) before processing commands
- Release lock (play.locked = False) after play completion
- Add warning logs for rejected duplicate submissions
- Add /diagnostics endpoint to health server for debugging

This prevents database corruption and duplicate processing when users
spam commands like "log xcheck" while the first is still processing.

Tested successfully in Discord - duplicate commands now properly return
PlayLockedException with instructions to wait.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-03 23:13:40 -06:00
Cal Corum
4be6afb541 Add API timeout/retry logic and fix get_team_by_owner for PostgreSQL
- Add APITimeoutError exception and retry logic to db_get
- Add timeout handling to db_post, db_put, db_patch, db_delete
- Fix get_team_by_owner to prefer non-gauntlet team (PostgreSQL migration fix)
- Code formatting cleanup (black)
2026-01-31 15:52:14 -06:00
Cal Corum
3debfd6e82 Catchup commit
Includes discord_ui refactor, testing overhaul, addition of
2025-07-22 09:22:19 -05:00
Cal Corum
a416e90db9 New postion sub logic 2025-03-09 00:59:10 -06:00
Cal Corum
f8aad38739 Update cache refresh logic to replace vs delete 2025-02-23 22:50:58 -06:00
Cal Corum
03337255c3 Legalitycheck exception 2025-01-24 10:05:35 -06:00
Cal Corum
cd0a8a739a Catchup edits 2025-01-23 10:59:03 -06:00
Cal Corum
724b8922f2 Update gauntlet get SP for new objects
Handle gamestates without full lineups
Added /set command for lineup and SP
Fixed uncapped hit bugs
Added league_name property to Games
Fix get_team for gauntlets
Fixed SelectSP dropdown bug
2024-12-27 16:12:25 -06:00
Cal Corum
3db25b177a Refactor new game checks
Trail batter-runner on uncapped hits
2024-12-26 14:36:04 -06:00
Cal Corum
f67135e2cf Added button option exception 2024-12-18 09:58:25 -06:00
Cal Corum
d6d3d7beb0 Log stealing done
Log xchecks started
2024-11-25 13:17:51 -06:00
Cal Corum
073bd04b4b Added RosterLinks to remove card_id from setup process
Add SelectStartingPitcher dropdown
New .sync function
2024-11-23 19:53:48 -06:00
Cal Corum
a4af7652fc ask_confirm bug fix
manual_end_game complete
2024-11-21 10:38:39 -06:00
Cal Corum
baffabfe4c Bunts are done 2024-11-16 01:34:02 -06:00
Cal Corum
3d333dabc3 Update api logging
New Position exception
Pull scouting data with lineups
More bunt types
String validation on gameplay models
AI Defensive alignment
2024-11-16 00:31:54 -06:00
Cal Corum
bfd72ae0f5 Update logging to RotatingFileHandler
Add auto game end
Calculate stats and decisions
Support raising instantiated exceptions
2024-11-09 23:14:54 -06:00
Cal Corum
c3418c4dfd New show-card dropdown view
Added PlayInitException
Added complete_and_post_play for log commands
Added many more log plays
Add undo-play
Added query logging
2024-11-09 00:48:13 -06:00
Cal Corum
0335b32673 Update exception function 2024-11-03 21:54:55 -06:00
Cal Corum
79efceb6dd refactor exceptions and continue gameplay cog rebuild 2024-10-24 15:32:07 -05:00