From db9f4d92074301c4598458f5bf0ed7080cb6083a Mon Sep 17 00:00:00 2001 From: Kumi Date: Sat, 25 May 2024 15:03:52 +0200 Subject: [PATCH] refactor(main): optimize server startup process Moved `update_data()` to execute before entering the main conditional logic in the server startup process. This adjustment ensures that data initialization occurs immediately upon server start, outside of the main function's scope. The change eliminates redundant print statements and streamlines the startup sequence, potentially improving the startup time and overall server responsiveness from the moment it goes live. This modification leads to a cleaner and more efficient codebase, enhancing maintainability and readability. --- src/structables/main.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/structables/main.py b/src/structables/main.py index d980377..b9b0ab6 100644 --- a/src/structables/main.py +++ b/src/structables/main.py @@ -1270,17 +1270,13 @@ def main(): if args.unsafe: unsafe = True - print("Loading initial data...") - - update_data() - - print("Started!") - if debugmode: app.logger.setLevel(logging.DEBUG) app.run(port=args.port, host=args.listen_host, debug=debugmode) - if __name__ == "__main__": main() + +# Initialize data when the server starts +update_data() \ No newline at end of file