fix(cmpp): honor UTC inbox retry leases
This commit is contained in:
@@ -1086,10 +1086,10 @@ startInboundWorkflowWorker() {
|
||||
FROM "CmppInboundSubmissionInbox"
|
||||
WHERE (
|
||||
status = 'pending'
|
||||
AND "nextAttemptAt" <= NOW()
|
||||
AND "nextAttemptAt" <= (NOW() AT TIME ZONE 'UTC')
|
||||
) OR (
|
||||
status = 'processing'
|
||||
AND "lockedAt" <= NOW() - make_interval(secs => ${staleSeconds})
|
||||
AND "lockedAt" <= (NOW() AT TIME ZONE 'UTC') - make_interval(secs => ${staleSeconds})
|
||||
)
|
||||
-- Priority applications enter the same durable Inbox, but are claimed first while
|
||||
-- preserving FIFO within each class. This keeps the V5 priority contract effective
|
||||
@@ -1101,9 +1101,9 @@ startInboundWorkflowWorker() {
|
||||
UPDATE "CmppInboundSubmissionInbox" AS inbox
|
||||
SET status = 'processing',
|
||||
attempts = inbox.attempts + 1,
|
||||
"lockedAt" = NOW(),
|
||||
"lockedAt" = (NOW() AT TIME ZONE 'UTC'),
|
||||
"lockedBy" = ${this.inboundWorkflowWorkerId},
|
||||
"updatedAt" = NOW()
|
||||
"updatedAt" = (NOW() AT TIME ZONE 'UTC')
|
||||
FROM candidates
|
||||
WHERE inbox.id = candidates.id
|
||||
RETURNING inbox.id, inbox."requestKey", inbox."applicationId", inbox.attempts, inbox.payload
|
||||
|
||||
Reference in New Issue
Block a user