Drop before_first_request usage of Flask app

Flask 2.3 removed this method, with recommended way of running
startup actions explicitly as part of app initialization.

Change-Id: I5dea1320c9aa63c1ef1742382cb46ea7cc56b10b
This commit is contained in:
Pavlo Shchelokovskyy 2023-11-21 17:54:21 +00:00
parent 11f52aa5d3
commit ad4664b9ac
1 changed files with 4 additions and 3 deletions

View File

@ -78,8 +78,10 @@ def _init_middleware():
def get_app():
"""Get the flask instance."""
_init_middleware()
return _app
with _app.app_context():
_init_middleware()
start_coordinator()
return _app
# TODO(kaifeng) Extract rpc related code into a rpcapi module
@ -196,7 +198,6 @@ def convert_exceptions(func):
return wrapper
@_app.before_first_request
def start_coordinator():
"""Create a coordinator instance for non-standalone case."""
if not CONF.standalone: