From 1414bb143228c442161f2e6c9bb5a775eacc67ef Mon Sep 17 00:00:00 2001 From: thug0bin Date: Fri, 27 Feb 2026 16:09:07 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20/admin=20=EC=82=AC=EC=9D=B4=EB=93=9C?= =?UTF-8?q?=EB=B0=94=20=EA=B2=80=EC=83=89=20SQLite=20=EC=97=B0=EA=B2=B0=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - /admin/search/user: new_connection=True + finally close - /admin/search/product: new_connection=True + finally close - 에러 로깅 강화 (traceback 포함) --- backend/app.py | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/backend/app.py b/backend/app.py index 49dad10..0a2e837 100644 --- a/backend/app.py +++ b/backend/app.py @@ -1416,10 +1416,10 @@ def admin_search_user(): if not query: return jsonify({'success': False, 'message': '검색어를 입력하세요'}), 400 - conn = db_manager.get_sqlite_connection() - cursor = conn.cursor() - + conn = None try: + conn = db_manager.get_sqlite_connection(new_connection=True) + cursor = conn.cursor() if search_type == 'phone_last': # 전화번호 뒷자리 검색 cursor.execute(""" @@ -1472,10 +1472,18 @@ def admin_search_user(): }) except Exception as e: + import traceback + logging.error(f"사용자 검색 실패: {e}\n{traceback.format_exc()}") return jsonify({ 'success': False, 'message': f'검색 실패: {str(e)}' }), 500 + finally: + if conn: + try: + conn.close() + except: + pass @app.route('/admin/search/product') @@ -1486,10 +1494,10 @@ def admin_search_product(): if not query: return jsonify({'success': False, 'message': '검색어를 입력하세요'}), 400 - conn = db_manager.get_sqlite_connection() - cursor = conn.cursor() - + conn = None try: + conn = db_manager.get_sqlite_connection(new_connection=True) + cursor = conn.cursor() # 1. MSSQL에서 제품명으로 거래번호 찾기 session = db_manager.get_session('PM_PRES') @@ -1560,10 +1568,18 @@ def admin_search_product(): }) except Exception as e: + import traceback + logging.error(f"제품 검색 실패: {e}\n{traceback.format_exc()}") return jsonify({ 'success': False, 'message': f'검색 실패: {str(e)}' }), 500 + finally: + if conn: + try: + conn.close() + except: + pass @app.route('/admin/ai-analyze-user/', methods=['POST'])