openvibers/openvibe.reviews Commits

Await what the transactions start (PostgreSQL pass follow-up): the service's db.tx callback called its async work without awaiting it. A sync callback that calls async code returns before the work is done, so writes could land outside or after their transaction. npm test 15/15.

OP OpenVibers committed 29 Sept 2026 · 2712ca20ed · 1 file, +1 −1


Changes

ddiff --git a/server/reviews/service.js b/server/reviews/service.js
iindex 59ae854..44f9493 100644
---- a/server/reviews/service.js
++++ b/server/reviews/service.js
@@@ -155,7 +155,7 @@ function createReviewsService({ db, stores, outbox, config, now = () => Date.now
// ── Small helpers ────────────────────────────────────────
const fail = (status, code, message, extra) => { throw new ReviewsError(status, code, message, extra); };
-- const tx = async (fn) => await db.tx(() => fn()); // ambient: plain db calls inside join it
++ const tx = async (fn) => await db.tx(async () => await fn()); // ambient: plain db calls inside join it
const entityPath = (e) => `/e/${encodeURIComponent(e.slug)}`;
const entityUrl = (e) => seo.canonicalUrl(origin, entityPath(e));
const parse = (s, d) => { try { return s == null ? d : JSON.parse(s); } catch { return d; } };