await on completed tasks, instead of calling .result()
This commit is contained in:
1 parent
4788ac8fbf
commit
5e53448451
2 files changed
+2
-2
No files matched your search
@@ -1858,7 +1858,7 @@ class GUIManager:
|
|||||||
task.cancel()
|
task.cancel()
|
||||||
if self._close_requested.is_set():
|
if self._close_requested.is_set():
|
||||||
raise ExitRequest()
|
raise ExitRequest()
|
||||||
return next(iter(done)).result()
|
return await next(iter(done))
|
||||||
|
|
||||||
def prevent_close(self):
|
def prevent_close(self):
|
||||||
self._close_requested.clear()
|
self._close_requested.clear()
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ async def first_to_complete(coros: abc.Iterable[abc.Coroutine[Any, Any, _T]]) ->
|
|||||||
done, pending = await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)
|
done, pending = await asyncio.wait(tasks, return_when=asyncio.FIRST_COMPLETED)
|
||||||
for task in pending:
|
for task in pending:
|
||||||
task.cancel()
|
task.cancel()
|
||||||
return next(iter(done)).result()
|
return await next(iter(done))
|
||||||
|
|
||||||
|
|
||||||
def chunk(to_chunk: abc.Iterable[_T], chunk_length: int) -> abc.Generator[list[_T], None, None]:
|
def chunk(to_chunk: abc.Iterable[_T], chunk_length: int) -> abc.Generator[list[_T], None, None]:
|
||||||
|
|||||||
Reference in new issue
Block a user