proxy: fix items mistakenly discarded

When emptying the pending queue, we need to break as soon as
as we failed to push an item to the data queue, otherwise only
the last failed item is pushed back to the front of the pending
queue, and all the previously failed items in the loop get
discarded
This commit is contained in:
Mathieu Duponchelle 2020-02-05 17:06:29 +01:00
parent bcae2423f5
commit 49f73fbf61

View file

@ -524,6 +524,7 @@ impl ProxySink {
while let Some(item) = pending_queue.items.pop_front() { while let Some(item) = pending_queue.items.pop_front() {
if let Err(item) = dataqueue.push(item).await { if let Err(item) = dataqueue.push(item).await {
failed_item = Some(item); failed_item = Some(item);
break;
} }
} }
@ -587,6 +588,7 @@ impl ProxySink {
while let Some(item) = pending_queue.items.pop_front() { while let Some(item) = pending_queue.items.pop_front() {
if let Err(item) = dataqueue.push(item).await { if let Err(item) = dataqueue.push(item).await {
failed_item = Some(item); failed_item = Some(item);
break;
} }
} }