mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-25 01:02:15 +00:00
fix(streaming): avoid duplicate chunk on cancel race in _put
When fut.cancel() returns False the coroutine already completed and the item is in the queue. Previously the loop would continue and enqueue the same item again. Now we return immediately when cancel fails, preventing duplicate chunks under tight timing.
This commit is contained in:
parent
a44de6ba9b
commit
4b980d9d9c
1 changed files with 2 additions and 1 deletions
|
|
@ -109,7 +109,8 @@ class _SyncIteratorToQueue:
|
|||
fut.result(timeout=0.5)
|
||||
return
|
||||
except TimeoutError:
|
||||
fut.cancel()
|
||||
if not fut.cancel():
|
||||
return
|
||||
continue
|
||||
except Exception:
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue