edenapi: move active transfer check into loop body

Summary: Due to the structure of this loop, we were unnecessarily blocking and polling when all curl transfers were already complete. To fix this, move the loop condition check to the middle of the loop.

Reviewed By: quark-zju

Differential Revision: D15124823

fbshipit-source-id: 92b7eee83cbfd62d590c21893f3235e1ca04fcec
This commit is contained in:
Arun Kulshreshtha 2019-04-29 13:14:47 -07:00 committed by Facebook Github Bot
parent 7abc07832c
commit 77ac4bc5c2

View File

@ -90,7 +90,7 @@ impl<H: Handler> MultiDriver<H> {
let mut failed = Vec::new();
let mut i = 0;
while in_progress > 0 {
loop {
log::trace!(
"Iteration {}: {}/{} transfers complete",
i,
@ -126,6 +126,11 @@ impl<H: Handler> MultiDriver<H> {
break;
}
if in_progress == 0 {
log::debug!("All transfers finished successfully.");
break;
}
let timeout = self.multi.get_timeout()?.unwrap_or(DEFAULT_TIMEOUT);
log::trace!("Waiting for I/O with timeout: {:?}", &timeout);