Releasing the db connection when an exception happens

pull/148/head
Matheus Lima 2019-05-22 12:27:35 -03:00
parent 1092f8f1ed
commit de0af15ae7
1 changed files with 6 additions and 1 deletions

View File

@ -1,5 +1,5 @@
from datetime import datetime
import json
from datetime import datetime
from http import HTTPStatus
from flask import current_app, Blueprint, g as global_context
@ -31,6 +31,11 @@ def handle_not_modified(error):
return '', HTTPStatus.NOT_MODIFIED
@selene_api.app_errorhandler(Exception)
def release_connection_after_error(error):
release_db_connection()
@selene_api.before_app_request
def setup_request():
global_context.start_ts = datetime.utcnow()