Разделить стенд и настройки нагрузочных экспериментов, ограничить число запросов на реплику в HAProxy и передавать X-Request-Id от балансировщика в API, сократить комментарии

This commit is contained in:
2026-11-04 12:23:14 +03:00
parent 7fbd781ca3
commit ce47c138e4
7 changed files with 94 additions and 111 deletions
+2 -10
View File
@@ -1,13 +1,6 @@
-- +goose Up
-- One row per Idempotency-Key a user has sent to one chat. The contract scope
-- is user + method + chat path + key; only POST /chats/{chat_id}/messages
-- accepts keys, so (user_id, chat_id) already fixes the method and the path.
-- The primary key is what makes concurrent retries through different
-- replicas safe: the second insert of a key waits for the first one's commit.
-- The row references the message instead of storing a response: messages
-- are immutable, so a replay is answered from the source of truth.
-- The table only adds to the schema: the previous API version keeps working
-- while a rolling update runs this migration.
-- Keys of POST /chats/{chat_id}/messages: the contract scope user + method +
-- chat path + key is (user_id, chat_id, key), as no other endpoint takes keys.
CREATE TABLE message_idempotency_keys (
user_id uuid NOT NULL,
chat_id uuid NOT NULL,
@@ -18,7 +11,6 @@ CREATE TABLE message_idempotency_keys (
FOREIGN KEY (chat_id, message_id) REFERENCES messages (chat_id, id)
);
-- Serves the periodic removal of keys older than the retention period.
CREATE INDEX message_idempotency_keys_created_at_idx ON message_idempotency_keys (created_at);
-- +goose Down