diff --git a/bin/trytond b/bin/trytond index c6e97136c6..b4877d15a5 100755 --- a/bin/trytond +++ b/bin/trytond @@ -31,8 +31,13 @@ from trytond.pool import Pool from trytond.modules import get_module_list, get_module_info with commandline.pidfile(options): + threads = [] for name in options.database_names: - threading.Thread(target=Pool(name).init).start() + thread = threading.Thread(target=Pool(name).init) + thread.start() + threads.append(thread) + for thread in threads: + thread.join() hostname, port = split_netloc(config.get('web', 'listen')) certificate = config.get('ssl', 'certificate') privatekey = config.get('ssl', 'privatekey') diff --git a/trytond/application.py b/trytond/application.py index 684752b6ee..a59a60907c 100644 --- a/trytond/application.py +++ b/trytond/application.py @@ -34,5 +34,10 @@ db_names = os.environ.get('TRYTOND_DATABASE_NAMES') if db_names: # Read with csv so database name can include special chars reader = csv.reader(StringIO(db_names)) + threads = [] for name in next(reader): - threading.Thread(target=Pool(name).init).start() + thread = threading.Thread(target=Pool(name).init) + thread.start() + threads.append(thread) + for thread in threads: + thread.join()