Skip to content

Commit

Permalink
non blocking done
Browse files Browse the repository at this point in the history
  • Loading branch information
lcw99 committed Feb 26, 2023
1 parent 616dcf4 commit 723364f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mii/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def get_pending_task_result(self, id):
if result is not None:
self.results = [item for item in self.results if item['id'] != id]
return result['result']
print(f"\ncalled id = {id}-----")
# print(f"\ncalled id = {id}-----")
if not self.running and len(self.tasks) > 0:
try:
self.running = True
task = self.tasks[0]
print(f"run started = {task['id']}")
print(f"{task['id']} started, queue={len(self.tasks)}")
self.tasks.remove(task)
response = self.asyncio_loop.run_until_complete(task['coro'])
print(f"{task['id']} complete")
Expand All @@ -140,7 +140,6 @@ def get_pending_task_result(self, id):
else:
self.results.append({"id": task['id'], "result": response.result()})
except Exception as e:
task['run'] = False
print(f"{task['id']}, {e}")
return None

0 comments on commit 723364f

Please sign in to comment.