dedc3b4183
- Full FastAPI backend with JWT auth, file management, processing pipeline, memory CRUD, barcode mappings, config management, cloud sync - Vue 3 + Element Plus frontend with dashboard, task history, HTTP logs, memory editor, barcode editor, config editor, sync page - HTTP request logging middleware with SQLite persistence - Task history tracking with progress and retry support - File metadata recording for upload/download operations - WebAuth section in config.ini for bcrypt password storage - Bug fix: logs.py count query returns tuple not dict Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
21 lines
684 B
Python
21 lines
684 B
Python
"""SQLite write serialization for async context"""
|
|
|
|
import asyncio
|
|
from typing import Callable, Any
|
|
|
|
|
|
class DBPool:
|
|
"""Serializes SQLite writes via asyncio.Lock. Reads are concurrent."""
|
|
|
|
def __init__(self):
|
|
self._write_lock = asyncio.Lock()
|
|
|
|
async def execute_write(self, fn: Callable, *args, **kwargs) -> Any:
|
|
async with self._write_lock:
|
|
loop = asyncio.get_event_loop()
|
|
return await loop.run_in_executor(None, lambda: fn(*args, **kwargs))
|
|
|
|
async def execute_read(self, fn: Callable, *args, **kwargs) -> Any:
|
|
loop = asyncio.get_event_loop()
|
|
return await loop.run_in_executor(None, lambda: fn(*args, **kwargs))
|