fix(qmd): keep models loaded until the daemon's own idle exit

QMD 2.8.3 createStore unloads the models after 5 idle minutes, which
made the next search reload them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian lechnerandClaude Opus 5.5 committed 2026-10-08 12:42:05 +02:00
1 parent 1618cd7cd0
commit ced6d8f119
2 files changed
+16 -1

No files matched your search

+7 -1
View File
@@ -5,7 +5,7 @@ import { execFileSync } from 'node:child_process';
import { mkdtempSync, rmSync, utimesSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { createServer, gitFingerprint } from '../../shared/qmd/qmd-daemon.mjs';
import { createServer, gitFingerprint, keepModelsLoaded } from '../../shared/qmd/qmd-daemon.mjs';
import { collectionName } from '../../shared/qmd/qmd-lib.mjs';
const defaultHits = () => [{ displayPath: `${collectionName('/r')}/src/a.ts`, body: 'x\nretry here', bestChunkPos: 2, bestChunk: 'retry here', score: 0.91 }];
@@ -168,3 +168,9 @@ test('refresh, stop, 404 and 403 on POST routes', async (t) => {
assert.deepEqual(await (await s.call('/stop', {})).json(), { stopping: true });
assert.equal(s.idle.length, 1);
});
test('keepModelsLoaded disables QMD unloading models after 5 idle minutes', () => {
const llm = { inactivityTimeoutMs: 5 * 60 * 1000, disposeModelsOnInactivity: true };
keepModelsLoaded({ internal: { llm } });
assert.deepEqual(llm, { inactivityTimeoutMs: 0, disposeModelsOnInactivity: false });
});