mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-01 15:35:12 +01:00
Merge qualified routine query-accounting repair into PR 18384
Co-Authored-By: Paperclip <noreply@paperclip.ing> * commit '85a1e9243e08f6864ef8b317daa9a1838fe1bdb5': test: distinguish status-card candidate and revision reads perf(server): stop recurring attention retention scans (#18388)
This commit is contained in:
commit
820101c4cb
1 file changed
+8
-4
@@ -352,15 +352,19 @@ const support = external ? { supported: true } : await getEmbeddedPostgresTestSu
|
||||
await flush();
|
||||
}
|
||||
await flush();
|
||||
// One eager reconciliation after idle and one bounded batched continuation;
|
||||
// the producers themselves are not counted as background SQL.
|
||||
const dueReads = () => select.mock.calls.filter(([fields]) => fields && "card" in fields && fields.card === statusCards).length;
|
||||
// One eager reconciliation after idle and one bounded batched continuation.
|
||||
// Each pass reads candidates once; evaluating its one changed card also
|
||||
// reads that card's revision for generation CAS. Bound both query classes
|
||||
// independently; the producers are not counted as background SQL.
|
||||
const dueReads = () => select.mock.calls.filter(([fields]) => fields && "card" in fields && fields.card === statusCards && !("revision" in fields)).length;
|
||||
const revisionReads = () => select.mock.calls.filter(([fields]) => fields && "card" in fields && fields.card === statusCards && "revision" in fields).length;
|
||||
const nextReads = () => select.mock.calls.filter(([fields]) => fields && "at" in fields && fields.at === statusCards.nextEvalAt).length;
|
||||
const elapsedMs = Date.now() - burstStarted;
|
||||
const maximum = Math.ceil(elapsedMs / 1000) + 2;
|
||||
console.info("status-card burst", { elapsedMs, maximum, runs: run.mock.calls.length, due: dueReads(), next: nextReads(), searches: searchedCompanies.length });
|
||||
console.info("status-card burst", { elapsedMs, maximum, runs: run.mock.calls.length, due: dueReads(), revisions: revisionReads(), next: nextReads(), searches: searchedCompanies.length });
|
||||
expect(run.mock.calls.length).toBeLessThanOrEqual(maximum);
|
||||
expect(dueReads()).toBeLessThanOrEqual(maximum); expect(nextReads()).toBeLessThanOrEqual(maximum);
|
||||
expect(revisionReads()).toBeLessThanOrEqual(maximum);
|
||||
expect(searchedCompanies.length).toBeLessThanOrEqual(maximum);
|
||||
expect(searchedCompanies.length).toBeGreaterThan(0);
|
||||
expect(new Set(searchedCompanies)).toEqual(new Set([originalCompany]));
|
||||
|
||||
Reference in new issue
Block a user