Change recv to try_recv (#5533)

This commit is contained in:
carllin
2019-08-15 15:17:46 -07:00
committed by GitHub
parent 88ea950652
commit d5fb493aa4

View File

@ -131,7 +131,7 @@ impl SnapshotPackagerService {
fn run(snapshot_receiver: &SnapshotPackageReceiver) -> Result<()> { fn run(snapshot_receiver: &SnapshotPackageReceiver) -> Result<()> {
let mut snapshot_package = snapshot_receiver.recv_timeout(Duration::from_secs(1))?; let mut snapshot_package = snapshot_receiver.recv_timeout(Duration::from_secs(1))?;
// Only package the latest // Only package the latest
while let Ok(new_snapshot_package) = snapshot_receiver.recv() { while let Ok(new_snapshot_package) = snapshot_receiver.try_recv() {
snapshot_package = new_snapshot_package; snapshot_package = new_snapshot_package;
} }
Self::package_snapshots(&snapshot_package)?; Self::package_snapshots(&snapshot_package)?;