Skip to content

Commit f22d17c

Browse files
committed
Auto merge of #8114 - alexcrichton:change-condition, r=Eh2406
Try to avoid panics on buggy (?) clocks Try to avoid panics with `Instant` by only performing infallible operations. This tweaks a comparison located in #8042 to use `Instant` comparisons rather than `Duration` comparisons which should hopefully eliminate a source of panics in the face of buggy (maybe?) clocks. I'm not sure whether this actually fixes the original issue, but seeing that we have a pretty low chance of the issue recurring, it's probably fine to go ahead and say... Closes #8042
2 parents 74e3a7d + be020a5 commit f22d17c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cargo/core/package.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -934,7 +934,7 @@ impl<'a, 'cfg> Downloads<'a, 'cfg> {
934934
}
935935

936936
// If we've spent too long not actually receiving any data we time out.
937-
if now - self.updated_at.get() > self.timeout.dur {
937+
if now > self.updated_at.get() + self.timeout.dur {
938938
self.updated_at.set(now);
939939
let msg = format!(
940940
"failed to download any data for `{}` within {}s",

0 commit comments

Comments
 (0)