fix: 加固 Outbox 租约与 Worker 生命周期

This commit is contained in:
root
2026-09-15 10:10:32 +08:00
parent ec573b5ae2
commit 5591d797fa
7 changed files with 502 additions and 80 deletions
+3 -2
View File
@@ -428,7 +428,7 @@ model Notification {
}
model OutboxEvent {
/// Processing lease index outbox_events_processing_lease_idx is managed in 0005 SQL.
/// Processing lease index outbox_events_processing_lease_idx is managed in 0007 SQL.
id String @id @default(uuid()) @db.Uuid
aggregateType String @map("aggregate_type") @db.VarChar(100)
aggregateId String @map("aggregate_id") @db.Uuid
@@ -439,12 +439,13 @@ model OutboxEvent {
attempts Int @default(0)
nextRetryAt DateTime @default(now()) @map("next_retry_at") @db.Timestamptz(3)
lockedAt DateTime? @map("locked_at") @db.Timestamptz(3)
lockToken String? @map("lock_token") @db.Uuid
publishedAt DateTime? @map("published_at") @db.Timestamptz(3)
createdAt DateTime @default(now()) @map("created_at") @db.Timestamptz(3)
updatedAt DateTime @updatedAt @map("updated_at") @db.Timestamptz(3)
@@index([status, nextRetryAt])
@@index([status, lockedAt], map: "outbox_events_processing_lease_idx")
@@index([status, lockedAt, lockToken], map: "outbox_events_processing_lease_idx")
@@index([aggregateType, aggregateId])
@@map("outbox_events")
}