diff --git a/apps/api/src/routes/events.ts b/apps/api/src/routes/events.ts index 1f675f2..ce8d899 100644 --- a/apps/api/src/routes/events.ts +++ b/apps/api/src/routes/events.ts @@ -307,6 +307,7 @@ eventsRouter.post('/create', zValidator('json', eventFieldsSchema), async (c) => payload: JSON.stringify(payload), }); + // must stay AFTER the enqueue commit — worker selects committed pending rows only signalOutboxDrain(); return c.json({ uid }, 202); } catch (err) { @@ -431,6 +432,7 @@ eventsRouter.patch('/:uid/edit', zValidator('json', eventFieldsSchema), async (c }); }); + // must stay AFTER the enqueue commit — worker selects committed pending rows only signalOutboxDrain(); return c.json({ uid: newUid }, 202); } @@ -447,6 +449,7 @@ eventsRouter.patch('/:uid/edit', zValidator('json', eventFieldsSchema), async (c payload: JSON.stringify(payload), }); + // must stay AFTER the enqueue commit — worker selects committed pending rows only signalOutboxDrain(); return c.json({ uid }, 202); } catch (err) { @@ -522,6 +525,7 @@ eventsRouter.delete('/:uid', async (c) => { etag: eventRow.etag ?? undefined, }); + // must stay AFTER the enqueue commit — worker selects committed pending rows only signalOutboxDrain(); return c.json({ uid }, 202); } catch (err) {