The degraded fallback: mtime-poll HEAD + packed-refs every 5 minutes and sync when they advance. Used when the inotify watcher cannot be built or dies (e.g. ENOSPC). Covers ONE project — never a global failure.
(
inner: &Arc<GitWatcherInner>,
state: &Arc<WatchState>,
common: Option<&Path>,
)
| 766 | /// sync when they advance. Used when the inotify watcher cannot be built or |
| 767 | /// dies (e.g. ENOSPC). Covers ONE project — never a global failure. |
| 768 | async fn degraded_poll_loop( |
| 769 | inner: &Arc<GitWatcherInner>, |
| 770 | state: &Arc<WatchState>, |
| 771 | common: Option<&Path>, |
| 772 | ) { |
| 773 | let mut last_sig: Option<(SystemTime, SystemTime)> = None; |
| 774 | loop { |
| 775 | state.health.beat(); |
| 776 | if let Some(common) = common { |
| 777 | let sig = metadata_signature(common); |
| 778 | if sig != last_sig && last_sig.is_some() { |
| 779 | let _permit = inner.sync_semaphore.acquire().await; |
| 780 | if sync_project( |
| 781 | &state.project_root, |
| 782 | &TraceDecayOpenOptions::default(), |
| 783 | inner.config.full_sync_escalation_files, |
| 784 | ) |
| 785 | .await |
| 786 | { |
| 787 | state.health.mark_synced(); |
| 788 | } |
| 789 | } |
| 790 | last_sig = sig; |
| 791 | } |
| 792 | tokio::time::sleep(DEGRADED_POLL_INTERVAL).await; |
| 793 | } |
| 794 | } |
| 795 | |
| 796 | /// mtime signature of HEAD + packed-refs for the degraded poller. |
| 797 | fn metadata_signature(common: &Path) -> Option<(SystemTime, SystemTime)> { |
no test coverage detected