Merge branch 'fix/backend-snapshot-null-read'

This commit is contained in:
Mina Choi 2026-09-14 17:09:48 +09:00
commit ff8d3653af

View File

@ -252,7 +252,7 @@ async def _local_contents(place) -> dict:
.order_by(area_contents.content_type.asc(), area_contents.collected_at.desc()) .order_by(area_contents.content_type.asc(), area_contents.collected_at.desc())
) )
err, rows = await DB_SESSION_MNG.execute_lambda( err, rows = await DB_SESSION_MNG.execute_lambda(
area_contents.DBType(), DBWRType.DB_READ.value, lambda s: DB_SESSION_MNG.execute(s, query) area_contents.DBType(), DBWRType.DB_READ.value, lambda s: DB_SESSION_MNG.execute(s, query, raise_error=False)
) )
if err != ErrorType.SUCCESS: if err != ErrorType.SUCCESS:
# ★ 지역 정보가 없다고 발행을 막지 않는다 — 사업장의 사실이 아니라 곁들이는 정보다. # ★ 지역 정보가 없다고 발행을 막지 않는다 — 사업장의 사실이 아니라 곁들이는 정보다.
@ -277,7 +277,7 @@ async def _local_contents(place) -> dict:
) )
err, rows = await DB_SESSION_MNG.execute_lambda( err, rows = await DB_SESSION_MNG.execute_lambda(
area_contents.DBType(), DBWRType.DB_READ.value, area_contents.DBType(), DBWRType.DB_READ.value,
lambda s: DB_SESSION_MNG.execute(s, shared_q), lambda s: DB_SESSION_MNG.execute(s, shared_q, raise_error=False),
) )
if err != ErrorType.SUCCESS: if err != ErrorType.SUCCESS:
LOG.w(f"[snapshot] 주변 정보 조회 실패 place={place_id}: {err.name}") LOG.w(f"[snapshot] 주변 정보 조회 실패 place={place_id}: {err.name}")
@ -353,7 +353,7 @@ async def _site_places(place_id) -> dict:
.limit(1) .limit(1)
) )
err, rows = await DB_SESSION_MNG.execute_lambda( err, rows = await DB_SESSION_MNG.execute_lambda(
site_sections.DBType(), DBWRType.DB_READ.value, lambda s: DB_SESSION_MNG.execute(s, q) site_sections.DBType(), DBWRType.DB_READ.value, lambda s: DB_SESSION_MNG.execute(s, q, raise_error=False)
) )
if err != ErrorType.SUCCESS or not rows: if err != ErrorType.SUCCESS or not rows:
return {} return {}
@ -405,9 +405,16 @@ def _iso(value) -> str | None:
async def _select(query) -> list: async def _select(query) -> list:
"""조회 실패는 **빈 목록**이다 — 미리보기·발행이 조각 하나 때문에 통째로 죽지 않게.
★ raise_error=False 가 핵심이다 (2026-09-14). 이 함수는 원래 실패를 [] 로 삼키도록
썼는데, DB 계층이 기본값 raise_error=True 로 **예외를 던져** 그 처리가 실행될 기회조차
없었다. 실측: place_songs 테이블이 없던 동안 미리보기가 통째로 HTTP 500 이었다 —
노래 한 칸이 빠진 화면 대신 아무것도 못 보는 화면이 나갔다.
"""
err, rows = await DB_SESSION_MNG.execute_lambda( err, rows = await DB_SESSION_MNG.execute_lambda(
place_facts.DBType(), place_facts.DBType(),
DBWRType.DB_READ.value, DBWRType.DB_READ.value,
lambda s: DB_SESSION_MNG.execute(s, query), lambda s: DB_SESSION_MNG.execute(s, query, raise_error=False),
) )
return list(rows) if err == ErrorType.SUCCESS else [] return list(rows) if err == ErrorType.SUCCESS else []