fix: 재료가 빠진 피드는 60초만 캐시, 예전 일반구 저장값을 시로 읽기, 습도 최적 35%

This commit is contained in:
minaChoi committed 2026-10-06 10:10:41 +09:00
1 parent 858bfca0b6
commit 2dfeec8996
5 files changed
+71 -30

No files matched your search

+17
View File
@@ -158,3 +158,20 @@ def test_gak_key_handles_sunset_window():
item = SimpleNamespace(definition=SimpleNamespace(windows=[{"around": "sunset", "hours": 1}]), rank=1)
assert _gak_key(item, 9) == (0, 8, 1)
assert _gak_key(item, 21) == (1, 0, 1)
@pytest.mark.anyio
async def test_feed_missing_gak_is_cached_only_briefly(offline, monkeypatch):
from common.cache.redis_client import REDIS
from common.enums import ErrorType
from services.index_service import IndexService
async def fail(*_):
return ErrorType.EXTERNAL_API_ERROR, None
monkeypatch.setattr(IndexService, "board", fail)
async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
body = (await client.get("/v1/feed", params={"region": REGION})).json()
assert PostType.GAK.value not in [p["post_type"] for p in body["posts"]]
keys = [k async for k in REDIS.conn.scan_iter(f"feed:{REGION}:*")]
assert keys and 0 < await REDIS.conn.ttl(keys[0]) <= 60