Browse Source

use ETag/Last-Modified only if URL hasn't changed

master
Astro 2 years ago
parent
commit
e1ef380b96
  1. 9
      src/main.rs

9
src/main.rs

@ -104,7 +104,14 @@ impl Resources {
.filter(schema::calendars::dsl::id.eq(id.clone()))
.set(schema::calendars::dsl::last_fetch.eq(Utc::now().naive_utc()))
.execute(&db)?;
Ok((cal.etag.clone(), cal.last_modified.clone()))
let result =
// Use ETag/Last-Modified only if URL hasn't changed
if cal.url == cal_opts.url {
(cal.etag.clone(), cal.last_modified.clone())
} else {
(None, None)
};
Ok(result)
}
}
})?;

Loading…
Cancel
Save