feat: 支持多实例客户端异常限流
This commit is contained in:
1 parent
4cd3749806
commit
2fe108d66a
18 files changed
+432
-90
No files matched your search
@@ -0,0 +1,28 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "ClientErrorThrottleWindow" (
|
||||
"subject" TEXT NOT NULL,
|
||||
"windowStart" TIMESTAMP(3) NOT NULL,
|
||||
"count" INTEGER NOT NULL,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
|
||||
CONSTRAINT "ClientErrorThrottleWindow_pkey" PRIMARY KEY ("subject")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "ClientErrorDedupe" (
|
||||
"id" TEXT NOT NULL,
|
||||
"subject" TEXT NOT NULL,
|
||||
"errorId" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
|
||||
CONSTRAINT "ClientErrorDedupe_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ClientErrorThrottleWindow_windowStart_idx" ON "ClientErrorThrottleWindow"("windowStart");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "ClientErrorDedupe_subject_errorId_key" ON "ClientErrorDedupe"("subject", "errorId");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE INDEX "ClientErrorDedupe_createdAt_idx" ON "ClientErrorDedupe"("createdAt");
|
||||
@@ -468,6 +468,25 @@ model AdminUser {
|
||||
templateAuditLogs TemplatePackageAuditLog[] @relation("TemplatePackageAuditActor")
|
||||
}
|
||||
|
||||
model ClientErrorThrottleWindow {
|
||||
subject String @id
|
||||
windowStart DateTime
|
||||
count Int
|
||||
updatedAt DateTime @updatedAt
|
||||
|
||||
@@index([windowStart])
|
||||
}
|
||||
|
||||
model ClientErrorDedupe {
|
||||
id String @id @default(uuid())
|
||||
subject String
|
||||
errorId String
|
||||
createdAt DateTime @default(now())
|
||||
|
||||
@@unique([subject, errorId])
|
||||
@@index([createdAt])
|
||||
}
|
||||
|
||||
model TemplatePackage {
|
||||
id String @id @default(uuid())
|
||||
packageKey String @unique
|
||||
|
||||
Reference in new issue
Block a user