(&self)
| 180 | } |
| 181 | |
| 182 | fn fresh_prices(&self) -> Vec<SourceResult> { |
| 183 | self.prices |
| 184 | .iter() |
| 185 | .filter(|(_, p)| p.timestamp + SERVE_TTL > Instant::now()) |
| 186 | .map(|(n, p)| SourceResult { |
| 187 | name: n.clone(), |
| 188 | price: p.price, |
| 189 | }) |
| 190 | .collect() |
| 191 | } |
| 192 | |
| 193 | fn is_drift_ok(&self) -> bool { |
| 194 | let mut cache_sorted_by_recency: Vec<(&String, &PriceCache)> = self.prices.iter().collect(); |