perf: batch gateway submits and isolate callbacks
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
CREATE TABLE "GatewaySubmitOutbox" (
|
||||
"id" TEXT NOT NULL,
|
||||
"submitId" TEXT NOT NULL,
|
||||
"messageRecordId" TEXT NOT NULL,
|
||||
"channelId" TEXT NOT NULL,
|
||||
"payload" JSONB NOT NULL,
|
||||
"schemaVersion" TEXT NOT NULL DEFAULT 'v1',
|
||||
"status" TEXT NOT NULL DEFAULT 'pending',
|
||||
"attemptCount" INTEGER NOT NULL DEFAULT 0,
|
||||
"nextAttemptAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"leaseOwner" TEXT,
|
||||
"leaseExpiresAt" TIMESTAMP(3),
|
||||
"streamEntryId" TEXT,
|
||||
"publishedAt" TIMESTAMP(3),
|
||||
"lastError" TEXT,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
CONSTRAINT "GatewaySubmitOutbox_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
CREATE UNIQUE INDEX "GatewaySubmitOutbox_submitId_key"
|
||||
ON "GatewaySubmitOutbox"("submitId");
|
||||
|
||||
CREATE INDEX "GatewaySubmitOutbox_pending_claim_idx"
|
||||
ON "GatewaySubmitOutbox"("nextAttemptAt", "createdAt")
|
||||
WHERE "status" IN ('pending', 'publishing');
|
||||
|
||||
CREATE INDEX "GatewaySubmitOutbox_messageRecordId_idx"
|
||||
ON "GatewaySubmitOutbox"("messageRecordId");
|
||||
Reference in New Issue
Block a user