esuls 0.1.12__py3-none-any.whl → 0.1.13__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- esuls/db_cli.py +27 -14
- {esuls-0.1.12.dist-info → esuls-0.1.13.dist-info}/METADATA +1 -1
- esuls-0.1.13.dist-info/RECORD +10 -0
- esuls-0.1.12.dist-info/RECORD +0 -10
- {esuls-0.1.12.dist-info → esuls-0.1.13.dist-info}/WHEEL +0 -0
- {esuls-0.1.12.dist-info → esuls-0.1.13.dist-info}/licenses/LICENSE +0 -0
- {esuls-0.1.12.dist-info → esuls-0.1.13.dist-info}/top_level.txt +0 -0
esuls/db_cli.py
CHANGED
|
@@ -57,20 +57,33 @@ class AsyncDB(Generic[SchemaType]):
|
|
|
57
57
|
if not hasattr(AsyncDB, '_initialized_schemas'):
|
|
58
58
|
AsyncDB._initialized_schemas = set()
|
|
59
59
|
|
|
60
|
-
async def _get_connection(self) -> aiosqlite.Connection:
|
|
61
|
-
"""Create a new optimized connection."""
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
60
|
+
async def _get_connection(self, max_retries: int = 5) -> aiosqlite.Connection:
|
|
61
|
+
"""Create a new optimized connection with retry logic for concurrent access."""
|
|
62
|
+
last_error = None
|
|
63
|
+
for attempt in range(max_retries):
|
|
64
|
+
try:
|
|
65
|
+
db = await aiosqlite.connect(self.db_path, timeout=30.0)
|
|
66
|
+
# Fast WAL mode with minimal sync
|
|
67
|
+
await db.execute("PRAGMA journal_mode=WAL")
|
|
68
|
+
await db.execute("PRAGMA synchronous=NORMAL")
|
|
69
|
+
await db.execute("PRAGMA cache_size=10000")
|
|
70
|
+
await db.execute("PRAGMA busy_timeout=30000") # 30s busy timeout
|
|
71
|
+
|
|
72
|
+
# Initialize schema if needed (check per unique schema)
|
|
73
|
+
if self._db_key not in AsyncDB._initialized_schemas:
|
|
74
|
+
await self._init_schema(db)
|
|
75
|
+
AsyncDB._initialized_schemas.add(self._db_key)
|
|
76
|
+
|
|
77
|
+
return db
|
|
78
|
+
except Exception as e:
|
|
79
|
+
last_error = e
|
|
80
|
+
if attempt < max_retries - 1:
|
|
81
|
+
# Exponential backoff: 0.1s, 0.2s, 0.4s, 0.8s, 1.6s
|
|
82
|
+
wait_time = 0.1 * (2 ** attempt)
|
|
83
|
+
await asyncio.sleep(wait_time)
|
|
84
|
+
continue
|
|
85
|
+
raise
|
|
86
|
+
raise last_error
|
|
74
87
|
|
|
75
88
|
async def _init_schema(self, db: aiosqlite.Connection) -> None:
|
|
76
89
|
"""Generate schema from dataclass structure with support for field additions."""
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
esuls/__init__.py,sha256=dtZtmjZZ8jNspOd17BWsE9D9ofeg3vZF0vIpSgKaZqk,529
|
|
2
|
+
esuls/db_cli.py,sha256=_5qEsfHr_cSDGitAe33hTNjVkfbHQxnPhEl1WDsuBIc,18901
|
|
3
|
+
esuls/download_icon.py,sha256=w-bWbyPSbWvonzq43aDDtdxIvdKSa7OSyZ7LaN0uudg,3623
|
|
4
|
+
esuls/request_cli.py,sha256=pILF8J9IILpTmWacm1vCtvDaef-kOXjkWAbcE2S9_cA,17962
|
|
5
|
+
esuls/utils.py,sha256=AAh9y8dSB1vGO8e7A10dpsYMPI5-e9gw-GPInYBoOvg,577
|
|
6
|
+
esuls-0.1.13.dist-info/licenses/LICENSE,sha256=AY0N01ARt0kbKB7CkByYLqqNQU-yalb-rpv-eXITEWA,1066
|
|
7
|
+
esuls-0.1.13.dist-info/METADATA,sha256=abi71dKeWsGmI0wB01XQUTtv9xKkN1bztcCze330m1Q,7002
|
|
8
|
+
esuls-0.1.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
esuls-0.1.13.dist-info/top_level.txt,sha256=WWBDHRhQ0DQLBZKD7Un8uFN93GvVQnP4WvJKkvbACVA,6
|
|
10
|
+
esuls-0.1.13.dist-info/RECORD,,
|
esuls-0.1.12.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
esuls/__init__.py,sha256=dtZtmjZZ8jNspOd17BWsE9D9ofeg3vZF0vIpSgKaZqk,529
|
|
2
|
-
esuls/db_cli.py,sha256=fGCKJDvPL1VeqLj8My-It1U0WIS365M6rakNMdzXbuk,18234
|
|
3
|
-
esuls/download_icon.py,sha256=w-bWbyPSbWvonzq43aDDtdxIvdKSa7OSyZ7LaN0uudg,3623
|
|
4
|
-
esuls/request_cli.py,sha256=pILF8J9IILpTmWacm1vCtvDaef-kOXjkWAbcE2S9_cA,17962
|
|
5
|
-
esuls/utils.py,sha256=AAh9y8dSB1vGO8e7A10dpsYMPI5-e9gw-GPInYBoOvg,577
|
|
6
|
-
esuls-0.1.12.dist-info/licenses/LICENSE,sha256=AY0N01ARt0kbKB7CkByYLqqNQU-yalb-rpv-eXITEWA,1066
|
|
7
|
-
esuls-0.1.12.dist-info/METADATA,sha256=wAUYuyCsfT5mFby1IYmbrWmT97YxnlBzrm5zshi4GXg,7002
|
|
8
|
-
esuls-0.1.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
-
esuls-0.1.12.dist-info/top_level.txt,sha256=WWBDHRhQ0DQLBZKD7Un8uFN93GvVQnP4WvJKkvbACVA,6
|
|
10
|
-
esuls-0.1.12.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|