fix(lps): 워커 로그 노이즈 2건 제거 — 리퍼 네이버 스킵 + 폴백 데드라인 cancel 제거

- browser-reaper가 close_if_idle 없는 어댑터(네이버 httpx)를 건너뛰도록 getattr 가드
  → 30초마다 반복되던 ERROR 로그 제거
- 폴백 데드라인을 wait_for(cancel) → asyncio.wait(버림)으로 변경
  → in-flight page.goto 취소 시 patchright 내부 future가 남기는
    'Future exception was never retrieved' 노이즈 제거, 페이지 어중간 상태 방지
  → 버려진 태스크는 강한 참조 집합(_abandoned_fallbacks)에 보관(GC 중도 파괴 방지),
    종료 시 콜백이 예외 회수 후 집합에서 제거
- 데드라인 테스트에 잔여 태스크 배수(drain) 검증 추가

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
민헌andClaude Fable 5 committed 2026-07-10 08:50:12 +09:00
1 parent 08a9c52088
commit ddb6f6bd2f
3 files changed
+35 -9

No files matched your search

+5 -1
View File
@@ -6,7 +6,7 @@ import pytest
from common.enums import JobType
from services.search.contract import NormalizedProduct, AdapterError
from worker.handlers import build_search_handler
from worker.handlers import build_search_handler, _abandoned_fallbacks
class FakeAdapter:
@@ -169,6 +169,10 @@ async def test_fallback_deadline_skips_slow_mall():
assert "11번가" in malls # 빠른 폴백 병합됨
assert "G마켓" not in malls # 느린 폴백은 데드라인 초과로 스킵
assert r["lowest"]["price"] == 3000 # G마켓 1000은 스킵됐으므로 최저가 아님
# 버려진 크롤은 cancel 없이 백그라운드 종료된다 — 루프 닫기 전에 배수(pending 태스크 파괴 경고 방지)
assert _abandoned_fallbacks # 느린 폴백이 버려짐
await asyncio.gather(*_abandoned_fallbacks, return_exceptions=True)
assert not _abandoned_fallbacks # 종료 콜백이 집합에서 제거함
async def test_fallback_failure_is_isolated():