API-03: zentrales-rate-limiting-api-gateway-schicht (postgres-basierter shared state)

This commit is contained in:
sysops
2026-08-28 08:14:20 +02:00
parent 27f9866264
commit a67adcefa1
6 changed files with 511 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
DROP TABLE rate_limit_counters;
DROP TABLE rate_limit_configs;
+15
View File
@@ -0,0 +1,15 @@
-- Rate-Limiting mit geteiltem, externem Zustand (API-03, siehe
-- core-kanban/tickets/API-03.md) — bewusst NICHT In-Process, damit mehrere
-- Dienstinstanzen dasselbe Limit korrekt durchsetzen.
CREATE TABLE rate_limit_configs (
key TEXT PRIMARY KEY,
limit_value INT NOT NULL,
window_seconds INT NOT NULL
);
CREATE TABLE rate_limit_counters (
key TEXT NOT NULL,
window_start TIMESTAMPTZ NOT NULL,
count INT NOT NULL DEFAULT 0,
PRIMARY KEY (key, window_start)
);