fix: 修复连接池泄漏(conn.close改为put_db) + put_db处理已关闭连接 + 添加日线同步cron

This commit is contained in:
freedakgmail
2026-07-22 07:12:09 +08:00
parent 488ef6b8e2
commit 9a5e24ccd6
5 changed files with 54 additions and 54 deletions
+8 -8
View File
@@ -43,7 +43,7 @@ def get_algo_templates():
except Exception as e:
return jsonify({'success': False, 'error': str(e)}), 500
finally:
conn.close()
put_db(conn)
# ═══════════════════════════════════════════════════════
@@ -78,7 +78,7 @@ def get_algo_config():
traceback.print_exc()
return jsonify({'success': False, 'error': str(e)}), 500
finally:
conn.close()
put_db(conn)
@bp.route('/config', methods=['POST'])
@@ -111,7 +111,7 @@ def save_algo_config():
traceback.print_exc()
return jsonify({'success': False, 'error': str(e)}), 500
finally:
conn.close()
put_db(conn)
@bp.route('/apply_template', methods=['POST'])
@@ -139,7 +139,7 @@ def apply_template():
conn.rollback()
return jsonify({'success': False, 'error': str(e)}), 500
finally:
conn.close()
put_db(conn)
# ═══════════════════════════════════════════════════════
@@ -164,7 +164,7 @@ def get_status():
traceback.print_exc()
return jsonify({'success': False, 'error': str(e)}), 500
finally:
conn.close()
put_db(conn)
# ═══════════════════════════════════════════════════════
@@ -205,7 +205,7 @@ def trigger_smart_trade():
traceback.print_exc()
return jsonify({'success': False, 'error': str(e)}), 500
finally:
conn.close()
put_db(conn)
# ═══════════════════════════════════════════════════════
@@ -242,7 +242,7 @@ def get_signals():
except Exception as e:
return jsonify({'success': False, 'error': str(e)}), 500
finally:
conn.close()
put_db(conn)
# ═══════════════════════════════════════════════════════
@@ -284,4 +284,4 @@ def get_position_meta():
traceback.print_exc()
return jsonify({'success': False, 'error': str(e)}), 500
finally:
conn.close()
put_db(conn)