| 197 | } |
| 198 | |
| 199 | pub fn expiry(&self, etime: OffsetDateTime) -> Option<(OffsetDateTime, OffsetDateTime)> { |
| 200 | match self { |
| 201 | // We can now do async prefetching on bg refreshes so this keeps everything in sync. |
| 202 | Classification::RepomdXmlSlow => Some(( |
| 203 | // We had to lower this because upstream often gets out of sync |
| 204 | etime + time::Duration::minutes(1), |
| 205 | etime + time::Duration::hours(24), |
| 206 | )), |
| 207 | Classification::RepomdXmlFast => Some(( |
| 208 | etime + time::Duration::minutes(1), |
| 209 | etime + time::Duration::minutes(180), |
| 210 | )), |
| 211 | Classification::Metadata => Some(( |
| 212 | etime + time::Duration::minutes(15), |
| 213 | etime + time::Duration::hours(24), |
| 214 | )), |
| 215 | Classification::Blob => Some(( |
| 216 | // etime + time::Duration::hours(2), |
| 217 | etime + time::Duration::minutes(15), |
| 218 | etime + time::Duration::hours(336), |
| 219 | )), |
| 220 | Classification::Static => Some(( |
| 221 | // Because OBS keeps publishing incorrect shit ... |
| 222 | // etime + time::Duration::hours(2), |
| 223 | etime + time::Duration::minutes(15), |
| 224 | etime + time::Duration::hours(336), |
| 225 | )), |
| 226 | Classification::Unknown => Some((etime, etime + time::Duration::minutes(5))), |
| 227 | Classification::Spam => None, |
| 228 | } |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | pub struct Cache { |