ЛР 5: очередь и асинхронная обработка изображений

This commit is contained in:
2026-11-11 19:59:42 +03:00
parent 276dbdad8a
commit af485c93d4
54 changed files with 1966 additions and 34 deletions
+11
View File
@@ -0,0 +1,11 @@
-- Lab3: one atomic idempotency result per user, chat and key.
CREATE TABLE IF NOT EXISTS message_idempotency (
user_id UUID NOT NULL REFERENCES users(id),
chat_id UUID NOT NULL REFERENCES chats(id) ON DELETE CASCADE,
idem_key VARCHAR(128) NOT NULL,
request_hash CHAR(64) NOT NULL,
message_id UUID NOT NULL UNIQUE REFERENCES messages(id) ON DELETE CASCADE,
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
PRIMARY KEY (user_id, chat_id, idem_key)
);
CREATE INDEX IF NOT EXISTS message_idempotency_expiry ON message_idempotency(created_at);