[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] 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.
---
 dak/show_new.py |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/dak/show_new.py b/dak/show_new.py
index 4880056..2ec2c35 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)
-- 
1.7.2.5


Reply to: