I have an API which increases a counter in SQLServer, but it generates too many secondary processes (in one hour I can create up to 40)
Am I closing the processes wrong? Is there any other method or alternative?
(I am using Flask and pyodbc)
@app.route('/datos', methods=['GET'])
def datos():
conn = get_db_connection()
if conn is None:
return jsonify({'error': 'Error al conectar a la base de datos'}), 500
cursor = conn.cursor()
cursor.execute('exec otros')
connmit()
cursor.close()
conn.close()
return "coneccion exitoso"
I'm looking for a way to leave the api running without vscode taking up all the memory on my pc.