mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 06:06:10 +00:00
fix(documents): make auto-index enqueue never fail a stored upload
The upload route awaited an unguarded enqueueDocumentIndex after the document was already committed. A transient boss.send rejection (a DB hiccup) would then surface as a 500 for an upload that in fact stored the file. Guard the send inside the enqueue (a failure annotates and no-ops, matching the missing-boss path) and drop the await at the call site so the response never blocks on or fails because of background indexing.
This commit is contained in:
1 parent
0b973f4f76
commit
eed705be7b
3 files changed
+32
-11
No files matched your search
@@ -365,10 +365,11 @@ async function postUpload(request: Request): Promise<Response> {
|
||||
|
||||
// Auto-index the freshly stored document for content search: enqueue a
|
||||
// fire-and-forget background job (provider-first, local text-layer fallback).
|
||||
// The upload response never blocks on or fails because of indexing; a missing
|
||||
// boss (worker not up) is a silent no-op. Only fresh inserts enqueue — a
|
||||
// The upload response never blocks on or fails because of indexing — the
|
||||
// enqueue is not awaited and swallows its own errors (a missing boss or a
|
||||
// transient send failure is a silent no-op). Only fresh inserts enqueue — a
|
||||
// duplicate upload returns early above and never reaches here.
|
||||
await enqueueDocumentIndex(user.id, document.id);
|
||||
void enqueueDocumentIndex(user.id, document.id);
|
||||
|
||||
const links = await loadConditionLinks(user.id, [document.id]);
|
||||
return apiSuccess(
|
||||
|
||||
Reference in new issue
Block a user