mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 05:12:14 +00:00
fix(documents): keep document reads inside their job's expiry
Since the lab staging reads a long report in parts, one auto-index could make the transcription plus up to twenty reads of two calls each at the person's response timeout, hours past pg-boss's fifteen-minute default, which failed the job and retried it beside the reads still running. The staging now takes the run's deadline as a schedule and plans only the reads that fit before it. The index job is long, with an expiry above the calls that run before the plan can say no, a stop on jobDeadline and a lock per document; the document run hands the same staging its own deadline, which moves the run's expiry as the reads are planned. The document summary, one call and its reasoning repeat, gets an expiry above that worst case. ocrReadCallMs in the read core is the one per-call timeout both deadlines divide by. The expiry guard now names every importer of the document and lab read entry points with the queues that reach it. The runtime guard's planted cases stripped every file's comments again on each rescan, which took over a second alone and timed out under a full parallel run; the stripped text is now memoised. Refs #1274
This commit is contained in:
1 parent
96eeec6080
commit
a1ee2ac003
21 files changed
+434
-76
No files matched your search
@@ -291,7 +291,10 @@ describe("POST /api/documents/inbound/[id]/index — staging continuation", () =
|
||||
} as never);
|
||||
const res = await POST(visionReq("doc-1") as never, ctx("doc-1") as never);
|
||||
expect(res.status).toBe(200);
|
||||
expect(maybeAutoStageLabFacts).toHaveBeenCalledWith("user-1", "doc-1");
|
||||
// A request has no deadline: the staging reads as it always did.
|
||||
expect(maybeAutoStageLabFacts).toHaveBeenCalledWith("user-1", "doc-1", {
|
||||
schedule: undefined,
|
||||
});
|
||||
const body = await res.json();
|
||||
expect(body.data.labFactsStaged).toBe(4);
|
||||
// Read with AI ends an import's hold on automatic AI reading (#1038),
|
||||
|
||||
Reference in new issue
Block a user