Skip to content

Commit aec1863

Browse files
BrainSlugs83Copilot
andcommitted
fix: idle shutdown now checks session-store.db mtime
Active copilot conversations write to session-store.db even when no vector-memory tools are called. The idle check now stats the session store file — if its mtime is newer than lastActivity, it counts as activity and prevents premature shutdown. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent cf7fb65 commit aec1863

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

vector-memory-server.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as sqliteVec from "sqlite-vec";
33
import { Worker } from "worker_threads";
44
import { join, dirname } from "path";
55
import { homedir } from "os";
6-
import { existsSync, writeFileSync, unlinkSync, readFileSync } from "fs";
6+
import { existsSync, writeFileSync, unlinkSync, readFileSync, statSync } from "fs";
77
import { fileURLToPath } from "url";
88
import { createServer, request as httpReq } from "http";
99
import { execSync } from "child_process";
@@ -341,6 +341,11 @@ setInterval(backgroundIndex, INDEX_INTERVAL_MS);
341341
// --- Idle shutdown ---
342342
if (IDLE_TIMEOUT_MS > 0) {
343343
setInterval(() => {
344+
// If session-store.db was recently modified, count as activity
345+
try {
346+
const mtime = statSync(SESSION_STORE_PATH).mtimeMs;
347+
if (mtime > lastActivity) lastActivity = mtime;
348+
} catch {}
344349
const idle = Date.now() - lastActivity;
345350
if (idle >= IDLE_TIMEOUT_MS) {
346351
process.stderr.write(`[vector-memory] Idle for ${Math.round(idle / 1000)}s — shutting down.\n`);

0 commit comments

Comments
 (0)