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.
This commit is contained in:
Kumi 2024-05-25 15:03:52 +02:00
parent 6c5faf6c19
commit db9f4d9207
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -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()