- 313 new markdown files created - 30 relationships embedded - 313 entries indexed - State initialized with usage data
26 lines
1.6 KiB
Markdown
26 lines
1.6 KiB
Markdown
---
|
|
id: 5d8e1ff5-3354-4cfa-ab63-bf96b5ce1e01
|
|
type: solution
|
|
title: "Fix for play lock never released on exception"
|
|
tags: [paper-dynasty, python, discord-bot, sqlalchemy, fix, play-lock, concurrency, critical]
|
|
importance: 0.95
|
|
confidence: 0.8
|
|
created: "2026-02-04T15:09:38.128767+00:00"
|
|
updated: "2026-02-04T15:09:38.128767+00:00"
|
|
relations:
|
|
- target: 9b70e3d5-d0b6-48c5-88d0-2fbc36f4fd4d
|
|
type: SOLVES
|
|
direction: incoming
|
|
strength: 0.5
|
|
- target: 1c795804-d2bd-4ace-8de8-aea4819424f0
|
|
type: CAUSES
|
|
direction: outgoing
|
|
strength: 0.5
|
|
- target: 88bbf5f1-2d76-4e68-9c62-ca72e464f5c0
|
|
type: BUILDS_ON
|
|
direction: outgoing
|
|
strength: 0.5
|
|
---
|
|
|
|
Implemented 3-layer defense against stuck play locks: (1) Added release_play_lock() helper function in logic_gameplay.py for manual lock release. (2) Created safe_play_lock() context manager that automatically releases locks on exception via try/except/finally. (3) Added automatic lock release to global error handler in paperdynasty.py @bot.tree.error - on ANY app command exception, checks if there's a locked play in the channel and releases it. This prevents all 13+ stuck locks we found in production. Updated error message from 'auto-unlock will trigger' (which didn't exist) to 'go call dad'. Added comprehensive tests in test_play_locking.py for lock release scenarios. Key files modified: command_logic/logic_gameplay.py (added release_play_lock, safe_play_lock context manager), paperdynasty.py (updated on_app_command_error), cogs/gameplay.py (imported new functions, example usage in end_game_command).
|