👩💻 Join our community of thousands of amazing developers!
A few days ago I wrote about doing a pile of work with concurrent.futures. Since then, I discovered a problem with the code: exceptions raised by the work function were silently ignored.Here’s the improved code that logs exceptions:def wait_first(futures): """ Wait for the first future to complete. Returns: (done, not_done): two sets of futures. """ return cf.wait(futures, return_when=cf.FIRST_COMPLETED) def do_work(threads, argsfn, workfn): """ Do a pile ...