Skip to content
Snippets Groups Projects
Commit 470275d6 authored by Joseph Weston's avatar Joseph Weston
Browse files

fix bug when already-completed futures are added

parent 97c4de07
No related branches found
No related tags found
No related merge requests found
...@@ -199,7 +199,8 @@ class Learner1D(object): ...@@ -199,7 +199,8 @@ class Learner1D(object):
async def any_complete(futures): async def any_complete(futures):
total = tornado.concurrent.Future() total = tornado.concurrent.Future()
for f in futures: for f in futures:
f.add_done_callback(total.set_result) f.add_done_callback(lambda f: total.set_result(None)
if not total.done() else None)
await total await total
return [f for f in futures if f.done()] return [f for f in futures if f.done()]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment