fix: ensure data update runs during app init

Moved `update_data` invocation to the initialization phase of the application rather than relying on the condition of running as the main module. This change ensures data is updated consistently, regardless of whether the app is run via a WSGI server or directly. This addresses initialization issues encountered in certain deployment scenarios.
This commit is contained in:
Kumi 2024-10-04 15:24:16 +02:00
parent 7682f4ba7f
commit be9de88eeb
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -14,6 +14,7 @@ app.config.from_object(Config)
app.typesense_api_key = get_typesense_api_key()
init_routes(app)
update_data(app)
def background_update_data(app):
@ -40,6 +41,3 @@ def main():
if __name__ == "__main__":
main()
else:
# Even if we're using a wsgi server, we still have to initialize global_ibles
update_data(app)