portfolio 60s → 180s (3분 폴링 → 3회당 1회 fetch) news-sent 300s → 600s (sentiment는 자주 안 바뀜) screener 60s → 300s (Top-20 분 단위 변화 미미) V2 재시작 시점부터 NAS stock에 대한 인바운드 호출이 분당 12 → 분당 3~4 로 감소 예상. 캐시 hit ratio 0~50% → 66~80%. 회귀 테스트 3건 추가로 미래 의도치 않은 TTL 변경 차단. Also update test_stock_client.py fake_time assertions from 61.0 → 181.0 to match the new 180s portfolio TTL (tests were TTL-dependent). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
19 lines
701 B
Python
19 lines
701 B
Python
# tests/test_stock_client_ttl.py
|
|
"""SP-A1 회귀 — _TTL이 NAS 부담 완화를 위한 값으로 설정되어 있어야 함."""
|
|
from signal_v2.stock_client import _TTL
|
|
|
|
|
|
def test_portfolio_ttl_is_180s():
|
|
"""portfolio TTL은 180초 이상 (3분 폴링에서 1회 fetch가 3 폴링 커버)."""
|
|
assert _TTL["portfolio"] >= 180.0
|
|
|
|
|
|
def test_news_sentiment_ttl_is_600s():
|
|
"""news-sentiment TTL은 600초 이상 (10분, 뉴스 sentiment는 자주 안 바뀜)."""
|
|
assert _TTL["news-sentiment"] >= 600.0
|
|
|
|
|
|
def test_screener_preview_ttl_is_300s():
|
|
"""screener-preview TTL은 300초 이상 (5분, Top-20은 분 단위로 거의 안 바뀜)."""
|
|
assert _TTL["screener-preview"] >= 300.0
|