Wait Pool.init threads before serving
In WSGI server that forks the main process, not waiting the end of threads creates a dead lock. issue9377 review311651002
This commit is contained in:
1 parent
bc01b3ed99
commit
cdb19908ee
2 files changed
+12
-2
No files matched your search
+6
-1
@@ -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')
|
||||
|
||||
@@ -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()
|
||||
Reference in new issue
Block a user