actually update last_checked

This commit is contained in:
xenofem 2022-04-05 18:50:55 -04:00
parent 91c69f00f5
commit 50a25c494a

View file

@ -61,8 +61,9 @@ impl PdfFetcher {
Err(_) => None, Err(_) => None,
}; };
let now = Instant::now();
if let Some(instant) = self.last_checked { if let Some(instant) = self.last_checked {
if Instant::now() - instant < *MIN_CHECK_INTERVAL { if now - instant < *MIN_CHECK_INTERVAL {
return if cache_modtime.is_some() { return if cache_modtime.is_some() {
self.cached_pdf() self.cached_pdf()
} else { } else {
@ -124,6 +125,7 @@ impl PdfFetcher {
<dyn futures::Sink<bytes::Bytes, Error = std::io::Error> + Unpin>::close(&mut sink) <dyn futures::Sink<bytes::Bytes, Error = std::io::Error> + Unpin>::close(&mut sink)
.await?; .await?;
} }
self.last_checked = Some(now);
self.cached_pdf() self.cached_pdf()
} }