(&mut self)
| 337 | } |
| 338 | |
| 339 | async fn check_new_logs(&mut self) -> Result<()> { |
| 340 | let logs = self.get_logs(10000).await?; |
| 341 | debug!("got {} logs", logs.len()); |
| 342 | let mut found_last_checked = false; |
| 343 | |
| 344 | for log in logs.iter() { |
| 345 | let log_id = log.id; |
| 346 | |
| 347 | if let Some(last_checked) = self.last_checked { |
| 348 | if log_id == last_checked { |
| 349 | found_last_checked = true; |
| 350 | break; |
| 351 | } |
| 352 | } |
| 353 | debug!("🔍 checking log id={}", log_id); |
| 354 | self.check_one_log(log).await?; |
| 355 | } |
| 356 | |
| 357 | if !found_last_checked && self.last_checked.is_some() { |
| 358 | bail!("last checked log not found, something went wrong"); |
| 359 | } |
| 360 | |
| 361 | if !logs.is_empty() { |
| 362 | let last_log = &logs[0]; |
| 363 | debug!("last checked: {}", last_log.id); |
| 364 | self.last_checked = Some(last_log.id); |
| 365 | } |
| 366 | |
| 367 | Ok(()) |
| 368 | } |
| 369 | |
| 370 | async fn run(&mut self) { |
| 371 | info!("monitoring {}...", self.base_domain); |
no test coverage detected