Empty check before pop (#4929)

# Check whether 'other' is empty before popping

This PR could fix a potential 'popping empty set' error.

Co-authored-by: Junlin Zhou <jlzhou@zjuici.com>
searx_updates
Junlin Zhou 12 months ago committed by GitHub
parent de6e6c764e
commit 9242998db1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -58,7 +58,8 @@ class AsyncIteratorCallbackHandler(AsyncCallbackHandler):
)
# Cancel the other task
other.pop().cancel()
if other:
other.pop().cancel()
# Extract the value of the first completed task
token_or_done = cast(Union[str, Literal[True]], done.pop().result())

Loading…
Cancel
Save