fix confusing variable name + comment

This commit is contained in:
Scott Lamb 2019-01-04 06:16:25 -08:00
parent de643f9f8d
commit 55fa458288
1 changed files with 7 additions and 6 deletions

View File

@ -349,25 +349,26 @@ impl<C: Clocks + Clone, D: DirWriter> Syncer<C, D> {
let next_flush = self.next_flush.take(); let next_flush = self.next_flush.take();
let cmd = match next_flush { let cmd = match next_flush {
None => match cmds.recv() { None => match cmds.recv() {
Err(_) => return, // all senders are gone. Err(_) => return, // all cmd senders are gone.
Ok(cmd) => cmd, Ok(cmd) => cmd,
}, },
Some((t, r, flushes)) => { Some((t, r, flush_senders)) => {
// Note: `flushes` will be dropped on exit from this block, which has the // Note: `flush_senders` will be dropped on exit from this block if left
// desired behavior of closing the channel. // unmoved, which has the desired behavior of closing the channels and
// notifying the receivers the flush occurred.
let now = self.db.clocks().monotonic(); let now = self.db.clocks().monotonic();
// Calculate the timeout to use, mapping negative durations to 0. // Calculate the timeout to use, mapping negative durations to 0.
let timeout = (t - now).to_std().unwrap_or(StdDuration::new(0, 0)); let timeout = (t - now).to_std().unwrap_or(StdDuration::new(0, 0));
match cmds.recv_timeout(timeout) { match cmds.recv_timeout(timeout) {
Err(mpsc::RecvTimeoutError::Disconnected) => return, // all senders gone. Err(mpsc::RecvTimeoutError::Disconnected) => return, // cmd senders gone.
Err(mpsc::RecvTimeoutError::Timeout) => { Err(mpsc::RecvTimeoutError::Timeout) => {
self.flush(&r); self.flush(&r);
continue continue
}, },
Ok(cmd) => { Ok(cmd) => {
self.next_flush = Some((t, r, flushes)); self.next_flush = Some((t, r, flush_senders));
cmd cmd
}, },
} }