fix: SQLite 멀티스레드 I/O 에러 해결

- 요청마다 새 SQLite 연결 생성 (new_connection=True)
- 사용 후 명시적 close
- 간헐적 'I/O operation on closed file' 에러 방지
This commit is contained in:
thug0bin
2026-02-27 15:43:52 +09:00
parent 870e40a6db
commit 76da7d9cd1
2 changed files with 42 additions and 27 deletions

View File

@@ -3029,9 +3029,10 @@ def api_member_history(phone):
transaction_ids = [] # 적립된 거래번호 수집
# 1. 마일리지 내역 조회 (SQLite)
# 1. 마일리지 내역 조회 (SQLite) - 새 연결 사용 (멀티스레드 안전)
sqlite_conn = None
try:
sqlite_conn = db_manager.get_sqlite_connection()
sqlite_conn = db_manager.get_sqlite_connection(new_connection=True)
cursor = sqlite_conn.cursor()
# 사용자 정보 조회
@@ -3108,6 +3109,13 @@ def api_member_history(phone):
except Exception as e:
logging.warning(f"마일리지 조회 실패: {e}")
finally:
# SQLite 연결 닫기
if sqlite_conn:
try:
sqlite_conn.close()
except:
pass
# 2. 전화번호로 POS 고객코드 조회 (MSSQL)
cuscode = None