Перенести API с общими сессиями и идемпотентной отправкой сообщения.

Реплика больше не держит корректность в своей памяти: сессия в Redis, а повтор POST сообщения фиксируется в Postgres вместе с X-Instance-Id.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-11-07 12:46:37 +03:00
co-authored by Cursor
parent 0ab3a341aa
commit c0d313703e
34 changed files with 2342 additions and 7 deletions
+17
View File
@@ -0,0 +1,17 @@
import os
import time
import pytest
from client import Client
@pytest.mark.expiry
def test_session_expires(live: Client):
ttl = int(os.environ.get("SESSION_TTL_SECONDS", "3600"))
if os.environ.get("RUN_EXPIRY") != "1":
pytest.skip("set RUN_EXPIRY=1 and SESSION_TTL_SECONDS<=3")
assert ttl <= 3
actor = live.user("ttl")
live.call("GET", "/api/v1/users/me", actor=actor, schema="User")
time.sleep(ttl + 1.5)
live.call("GET", "/api/v1/users/me", 401, actor=actor)