🟠 High: Synchronous SQLite in Async Context
Problem Description
All sqlite3 operations use sqlite3.connect() which is a synchronous, blocking API. These are called within async functions without using asyncio.to_thread().
GamesDatabase (cog/games.py)
# cog/games.py line 11
self.conn = sqlite3.connect(db_name) # Shared sync connection
Reminder Database (cog/reminder.py)
Multiple sqlite3.connect() calls throughout worker loop.
Exact Location
- File:
cog/games.py lines 9-43, 824-826
- File:
cog/reminder.py lines 339, 441, 654, 669, 741, 756, 773
Impact
- Blocking the event loop causes command processing delays
- Potential timeouts under load
- "database locked" errors during concurrent game sessions
Recommended Fix
Wrap blocking calls with asyncio.to_thread():
await asyncio.to_thread(self.db.update_stats, user_id, result, game, bot_user_id)
Or migrate to aiosqlite (already in requirements.txt but unused).
Severity
HIGH — Event loop blocking causes responsiveness issues.
🟠 High: Synchronous SQLite in Async Context
Problem Description
All sqlite3 operations use
sqlite3.connect()which is a synchronous, blocking API. These are called within async functions without usingasyncio.to_thread().GamesDatabase (cog/games.py)
Reminder Database (cog/reminder.py)
Multiple
sqlite3.connect()calls throughout worker loop.Exact Location
cog/games.pylines 9-43, 824-826cog/reminder.pylines 339, 441, 654, 669, 741, 756, 773Impact
Recommended Fix
Wrap blocking calls with
asyncio.to_thread():Or migrate to
aiosqlite(already in requirements.txt but unused).Severity
HIGH — Event loop blocking causes responsiveness issues.