Skip to content

Commit

Permalink
Correct task wait sleep time
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Sep 8, 2023
1 parent 73b37f5 commit c89b566
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion reportportal_client/aio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,12 +737,13 @@ def create_task(self, coro: Any) -> asyncio.Task:
return result

def finish_tasks(self):
sleep_time = sys.getswitchinterval()
shutdown_start_time = time.time()
for task in self.__task_list:
task_start_time = time.time()
while not task.done() and (time.time() - task_start_time < TASK_TIMEOUT) and (
time.time() - shutdown_start_time < SHUTDOWN_TIMEOUT):
time.sleep(0.001)
time.sleep(sleep_time)
if time.time() - shutdown_start_time >= SHUTDOWN_TIMEOUT:
break
self.__task_list = []
Expand Down

0 comments on commit c89b566

Please sign in to comment.