Move server set up to right before run call.

This commit is contained in:
Robin Huang 2024-08-07 12:20:02 -07:00
parent c36a559564
commit 9632dded9e

View File

@ -214,7 +214,6 @@ if __name__ == "__main__":
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
server = server.PromptServer(loop)
loop.run_until_complete(server.setup())
q = execution.PromptQueue(server)
extra_model_paths_config_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "extra_model_paths.yaml")
@ -262,6 +261,7 @@ if __name__ == "__main__":
call_on_start = startup_server
try:
loop.run_until_complete(server.setup())
loop.run_until_complete(run(server, address=args.listen, port=args.port, verbose=not args.dont_print_server, call_on_start=call_on_start))
except KeyboardInterrupt:
logging.info("\nStopped server")