@donkeylabs/server 2.5.0 → 2.5.1
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
CHANGED
|
@@ -49,12 +49,12 @@ export class KyselyProcessAdapter implements ProcessAdapter {
|
|
|
49
49
|
this.db = db as Kysely<Database>;
|
|
50
50
|
this.cleanupDays = config.cleanupDays ?? 7;
|
|
51
51
|
|
|
52
|
-
// Start cleanup timer
|
|
52
|
+
// Start cleanup timer - delay initial cleanup to allow migrations to run first
|
|
53
53
|
if (this.cleanupDays > 0) {
|
|
54
54
|
const interval = config.cleanupInterval ?? 3600000; // 1 hour
|
|
55
55
|
this.cleanupTimer = setInterval(() => this.cleanup(), interval);
|
|
56
|
-
//
|
|
57
|
-
this.cleanup();
|
|
56
|
+
// Delay initial cleanup to ensure table exists after migrations
|
|
57
|
+
setTimeout(() => this.cleanup(), 5000);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
|
|
@@ -226,19 +226,28 @@ export class KyselyProcessAdapter implements ProcessAdapter {
|
|
|
226
226
|
async getOrphaned(): Promise<ManagedProcess[]> {
|
|
227
227
|
if (this.checkStopped()) return [];
|
|
228
228
|
|
|
229
|
-
|
|
230
|
-
.
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
eb(
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
229
|
+
try {
|
|
230
|
+
const rows = await this.db
|
|
231
|
+
.selectFrom("__donkeylabs_processes__")
|
|
232
|
+
.selectAll()
|
|
233
|
+
.where((eb) =>
|
|
234
|
+
eb.or([
|
|
235
|
+
eb("status", "=", "running"),
|
|
236
|
+
eb("status", "=", "spawning"),
|
|
237
|
+
eb("status", "=", "orphaned"),
|
|
238
|
+
])
|
|
239
|
+
)
|
|
240
|
+
.execute();
|
|
240
241
|
|
|
241
|
-
|
|
242
|
+
return rows.map((r) => this.rowToProcess(r));
|
|
243
|
+
} catch (err: any) {
|
|
244
|
+
// Silently ignore if table doesn't exist yet (migrations not run)
|
|
245
|
+
const message = err?.message?.toLowerCase() || "";
|
|
246
|
+
if (message.includes("does not exist") || message.includes("no such table")) {
|
|
247
|
+
return [];
|
|
248
|
+
}
|
|
249
|
+
throw err;
|
|
250
|
+
}
|
|
242
251
|
}
|
|
243
252
|
|
|
244
253
|
private rowToProcess(row: ProcessesTable): ManagedProcess {
|