From: Ansgar Burchardt Date: Mon, 7 Jan 2013 09:32:19 +0000 (+0100) Subject: dak/show_new.py: use apply_async instead of map_async X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=b70ed9811d09a6906b523af26b68d2bd8d004a3b;p=dak.git 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. --- diff --git a/dak/show_new.py b/dak/show_new.py index 48800563..2ec2c351 100755 --- a/dak/show_new.py +++ b/dak/show_new.py @@ -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)