dak/show_new.py: use apply_async instead of map_async

The map variant established multiple database connections in each worker
exceeding the maximum number of connections configured in PostgreSQL.
apply_async doesn't have this problem with our wrapper in DakProcessPool.

However as a regression we longer have a timeout and always have to wait for
the job to finish. This could be worked around by using the timeout function
for individual results.
上级 eda72470
......@@ -256,10 +256,12 @@ def main():
upload_ids = [ u.id for u in init(session) ]
session.close()
p = pool.map_async(do_pkg, upload_ids)
for upload_id in upload_ids:
pool.apply_async(do_pkg, [upload_id])
pool.close()
p.wait(timeout=600)
#p.wait(timeout=600)
pool.join()
for htmlfile in htmlfiles_to_process:
with open(htmlfile, "w") as fd:
fd.write(timeout_str)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册