feat: T4 wave 3 - notifications per user, suggestions API, varroa bands, split/queen events
- Schema III: per-user notifications (broadcast fan-out migration, category, link, requiredPermissions filter), notification preferences and settings endpoints, calendar withdrawal switch, occupiedFrames - Suggestions API: list/summary with permission visibility and paging, accept/dismiss/reopen incl. bulk, SuggestionView on all responses - Varroa traffic light by season and method, young colonies, treatment effect window, sample-based percentage; shared withdrawal-window helper on Berlin calendar days; GET /varroa-measurements/thresholds - ColonySplit and QueenAssigned domain events with calendar and webhook handlers - Outbox claims compare against now() rounded to timestamp(3); fixes the flaky e2e claims of rows written with SQL now() Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
1 parent
d99a697739
commit
f468dc5f75
87 files changed
+6022
-510
No files matched your search
@@ -71,9 +71,13 @@ function orderColumn(column: OutboxOrderColumn): Prisma.Sql {
|
||||
}
|
||||
|
||||
/**
|
||||
* Claims up to `limit` due PENDING entries, oldest first. SKIP LOCKED lets
|
||||
* several workers claim side by side without waiting for or overlapping
|
||||
* each other. Returns the claimed rows (all columns) in claim order.
|
||||
* Claims up to `limit` due PENDING entries, oldest first. "availableAt" is
|
||||
* TIMESTAMP(3), so a value written from now() is rounded to the nearest
|
||||
* millisecond - up to 0.5 ms ahead of the clock. Comparing against now()
|
||||
* rounded the same way keeps such an entry due as soon as it is written;
|
||||
* a plain now() would miss it for the first fraction of a millisecond.
|
||||
* SKIP LOCKED lets several workers claim side by side without waiting for
|
||||
* or overlapping each other. Returns the claimed rows (all columns) in claim order.
|
||||
* Uses the root client: a claim must commit on its own.
|
||||
*/
|
||||
export async function claimBatch<Row>(
|
||||
@@ -96,7 +100,7 @@ export async function claimBatch<Row>(
|
||||
UPDATE ${name} SET "status" = 'PROCESSING', "claimedAt" = now()
|
||||
WHERE "id" IN (
|
||||
SELECT "id" FROM ${name}
|
||||
WHERE "status" = 'PENDING' AND "availableAt" <= now() ${filter}
|
||||
WHERE "status" = 'PENDING' AND "availableAt" <= CAST(now() AS timestamp(3)) ${filter}
|
||||
ORDER BY ${orderBy}
|
||||
LIMIT ${options.limit}
|
||||
FOR UPDATE SKIP LOCKED
|
||||
|
||||
Reference in new issue
Block a user