feat: add async SQLite on Node 24 and improve messaging diagnostics (#520)
Move database work off the main thread on Node.js 24 and improve message handling and runtime diagnostics. Preserve migration, restart, and concurrency coverage with the async SQLite driver.
This commit is contained in:
1 parent
20f48d11ec
commit
c7428363cb
170 files changed
+7748
-3913
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { isObject } from './coerce';
|
||||
|
||||
export interface RuntimeConfig {
|
||||
webuiPort?: number;
|
||||
@@ -395,10 +396,6 @@ function parseBoolValue(raw: unknown): boolean | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function isObject(value: unknown): value is Record<string, unknown> {
|
||||
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
||||
}
|
||||
|
||||
function isErrnoCode(error: unknown, code: string): boolean {
|
||||
return error instanceof Error && 'code' in error && error.code === code;
|
||||
}
|
||||
@@ -71,18 +71,17 @@ export class SingleFlightCache<K, V> {
|
||||
}
|
||||
|
||||
const task = (async () => {
|
||||
try {
|
||||
const value = await this.load(key);
|
||||
const value = await this.load(key);
|
||||
|
||||
if (this.shouldCache(value)) {
|
||||
this.fresh.set(key, { at: this.now(), value });
|
||||
}
|
||||
|
||||
return value;
|
||||
} finally {
|
||||
this.inflight.delete(key);
|
||||
if (this.shouldCache(value)) {
|
||||
this.fresh.set(key, { at: this.now(), value });
|
||||
}
|
||||
})();
|
||||
|
||||
return value;
|
||||
})().finally(() => {
|
||||
// Run after registration even when load throws synchronously.
|
||||
this.inflight.delete(key);
|
||||
});
|
||||
this.inflight.set(key, task);
|
||||
return task;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user