@travetto/model-sqlite 4.0.2 → 4.0.4
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.
- package/package.json +6 -6
- package/src/connection.ts +2 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@travetto/model-sqlite",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.4",
|
|
4
4
|
"description": "SQLite backing for the travetto model module, with real-time modeling support for SQL schemas.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sql",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"directory": "module/model-sqlite"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@travetto/config": "^4.0.
|
|
30
|
-
"@travetto/context": "^4.0.
|
|
31
|
-
"@travetto/model": "^4.0.
|
|
32
|
-
"@travetto/model-query": "^4.0.
|
|
33
|
-
"@travetto/model-sql": "^4.0.
|
|
29
|
+
"@travetto/config": "^4.0.4",
|
|
30
|
+
"@travetto/context": "^4.0.4",
|
|
31
|
+
"@travetto/model": "^4.0.4",
|
|
32
|
+
"@travetto/model-query": "^4.0.4",
|
|
33
|
+
"@travetto/model-sql": "^4.0.4",
|
|
34
34
|
"@types/better-sqlite3": "^7.6.9",
|
|
35
35
|
"better-sqlite3": "^9.4.0"
|
|
36
36
|
},
|
package/src/connection.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import fs from 'node:fs/promises';
|
|
2
|
-
import timers from 'node:timers/promises';
|
|
3
2
|
import sqlDb, { type Database, Options } from 'better-sqlite3';
|
|
4
3
|
import { Pool, createPool } from 'generic-pool';
|
|
5
4
|
|
|
6
5
|
import { RuntimeContext, path } from '@travetto/manifest';
|
|
7
|
-
import { ShutdownManager } from '@travetto/base';
|
|
6
|
+
import { ShutdownManager, Util } from '@travetto/base';
|
|
8
7
|
import { AsyncContext, WithAsyncContext } from '@travetto/context';
|
|
9
8
|
import { ExistsError } from '@travetto/model';
|
|
10
9
|
import { SQLModelConfig, Connection } from '@travetto/model-sql';
|
|
@@ -34,7 +33,7 @@ export class SqliteConnection extends Connection<Database> {
|
|
|
34
33
|
} catch (err) {
|
|
35
34
|
if (err instanceof Error && retries > 1 && err.message.includes('database is locked')) {
|
|
36
35
|
console.error('Failed, and waiting', retries);
|
|
37
|
-
await
|
|
36
|
+
await Util.blockingTimeout(delay);
|
|
38
37
|
retries -= 1;
|
|
39
38
|
} else {
|
|
40
39
|
throw err;
|