mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-11 13:52:20 +00:00
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
24 lines
835 B
TypeScript
24 lines
835 B
TypeScript
/**
|
|
* The queue facts of `document-summary.ts`: its name and, where it has them, its
|
|
* schedule and concurrency. They live apart from the handler so the worker
|
|
* registry and every sender can read them without loading the job.
|
|
*/
|
|
import {
|
|
COMPLETION_CEILING_MS,
|
|
expireAboveModelTime,
|
|
} from "@/lib/jobs/model-time";
|
|
|
|
export const DOCUMENT_SUMMARY_QUEUE = "document-summary";
|
|
|
|
/**
|
|
* The job's expiry: one summary call (`DOCUMENT_SUMMARY_MODEL_CALLS`) and its
|
|
* reasoning repeat at the largest response timeout, plus headroom. Two
|
|
* ten-minute attempts outlived pg-boss's fifteen-minute default (#1274).
|
|
*/
|
|
export const DOCUMENT_SUMMARY_EXPIRE_SECONDS = expireAboveModelTime(
|
|
COMPLETION_CEILING_MS,
|
|
);
|
|
|
|
/** Serial concurrency — provider calls, kept off the request pool. */
|
|
export const DOCUMENT_SUMMARY_CONCURRENCY = 1;
|