mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
fix(intake,dashboard): use Promise.allSettled around bulk-projection compliance recompute
The recompute helper swallows errors internally today, but the contract is fragile — any future refactor that lets a throw escape would turn the intake POST or dashboard summary GET into a 5xx for a strictly best-effort hook. Wrap both call sites in `Promise.allSettled` so the fail-soft contract is explicit at the call site, not buried in the helper. Closes specialist H1 from the v1.4.40 QA round.
This commit is contained in:
1 parent
926ac36dea
commit
853792ca06
2 files changed
+12
-2
No files matched your search
@@ -373,7 +373,12 @@ async function projectAndReadTodaysIntakes(
|
||||
}),
|
||||
);
|
||||
}
|
||||
await Promise.all(recomputeJobs);
|
||||
// Defence in depth (specialist H1): the helper swallows internally
|
||||
// today, but any future refactor that lets a throw escape would
|
||||
// turn the dashboard summary into a 5xx. `allSettled` keeps the
|
||||
// best-effort contract explicit at the call site so the request
|
||||
// stays 200-OK regardless of helper behaviour.
|
||||
await Promise.allSettled(recomputeJobs);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,12 @@ export const GET = apiHandler(async (request: NextRequest) => {
|
||||
}),
|
||||
);
|
||||
}
|
||||
await Promise.all(recomputeJobs);
|
||||
// Defence in depth (specialist H1): the helper swallows internally
|
||||
// today, but any future refactor that lets a throw escape would
|
||||
// turn the intake POST into a 5xx. `allSettled` keeps the
|
||||
// best-effort contract explicit at the call site so the request
|
||||
// stays 200-OK regardless of helper behaviour.
|
||||
await Promise.allSettled(recomputeJobs);
|
||||
}
|
||||
|
||||
const events = await prisma.medicationIntakeEvent.findMany({
|
||||
|
||||
Reference in new issue
Block a user