- 313 new markdown files created - 30 relationships embedded - 313 entries indexed - State initialized with usage data
1.3 KiB
| id | type | title | tags | importance | confidence | created | updated | relations | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 88bbf5f1-2d76-4e68-9c62-ca72e464f5c0 | code_pattern | Optional locking parameter pattern for read vs write commands |
|
0.75 | 0.8 | 2026-02-04T15:53:57.725265+00:00 | 2026-02-04T15:53:57.725265+00:00 |
|
In Paper Dynasty, added lock_play parameter (default=True) to checks_log_interaction() to distinguish read-only commands from write commands. Read-only commands like /show-card and /settings-ingame use lock_play=False to avoid unnecessary locking. Write commands that modify play state use default lock_play=True. This reduces lock contention and prevents blocking users during non-critical operations. Pattern: Create single validation function with optional locking, rather than duplicating validation logic for read vs write. Also moved actual state modifications to callbacks (dropdown selections) where lock is acquired at last possible moment, keeping commands themselves lock-free. Structure: Command shows UI -> User interaction triggers callback -> Callback acquires lock -> Modifies state -> Releases lock. This minimizes lock hold time.