(project_path: PathBuf, handshake: DaemonHandshake)
| 1560 | |
| 1561 | #[cfg(unix)] |
| 1562 | async fn run_automation_scheduler_loop(project_path: PathBuf, handshake: DaemonHandshake) { |
| 1563 | loop { |
| 1564 | log_daemon_event( |
| 1565 | "scheduler_tick", |
| 1566 | &[ |
| 1567 | ("project", project_path.display().to_string()), |
| 1568 | ("outcome", "start".to_string()), |
| 1569 | ], |
| 1570 | ); |
| 1571 | if let Err(e) = Box::pin(run_automation_scheduler_tick(&project_path, &handshake)).await { |
| 1572 | log_daemon_event( |
| 1573 | "scheduler_tick", |
| 1574 | &[ |
| 1575 | ("project", project_path.display().to_string()), |
| 1576 | ("outcome", "error".to_string()), |
| 1577 | ("error", e.to_string()), |
| 1578 | ], |
| 1579 | ); |
| 1580 | } |
| 1581 | let tick_secs = Box::pin(automation_scheduler_tick_secs_for_project( |
| 1582 | &project_path, |
| 1583 | &handshake, |
| 1584 | )) |
| 1585 | .await; |
| 1586 | log_daemon_event( |
| 1587 | "scheduler_sleep", |
| 1588 | &[ |
| 1589 | ("project", project_path.display().to_string()), |
| 1590 | ("next_tick_secs", tick_secs.to_string()), |
| 1591 | ], |
| 1592 | ); |
| 1593 | tokio::time::sleep(Duration::from_secs(tick_secs)).await; |
| 1594 | } |
| 1595 | } |
| 1596 | |
| 1597 | #[cfg(unix)] |
| 1598 | async fn automation_scheduler_tick_secs_for_project( |
no test coverage detected