Enable WAL mode for concurrent database access

- Enable PRAGMA journal_mode=WAL for better concurrent access
- Set PRAGMA busy_timeout=5000 (5 seconds) for concurrent access
- WAL mode allows multiple readers and one writer simultaneously
parent 7628a6be
......@@ -60,9 +60,17 @@ class DatabaseManager:
def _initialize_database(self):
"""Create database tables if they don't exist."""
# Enable WAL mode for better concurrent access
# WAL allows multiple readers and one writer simultaneously
with sqlite3.connect(self.db_path) as conn:
cursor = conn.cursor()
# Enable WAL mode for concurrent access
cursor.execute('PRAGMA journal_mode=WAL')
# Set busy timeout to 5 seconds for concurrent access
cursor.execute('PRAGMA busy_timeout=5000')
# Create context_dimensions table for tracking context usage
cursor.execute('''
CREATE TABLE IF NOT EXISTS context_dimensions (
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment