Budget for opening a repository database (or the change store inside it) when another process may hold the writer lock. Every hook invocation is a separate process, so cross-process coordination waits on a bounded budget rather than failing the open: short-lived writers (a recording agent turn, a gated daemon mutation) finish first, and the contested open then succeeds. Waiting longer is always s
()
| 43 | /// |
| 44 | /// Override with `ATOMIC_DB_LOCK_WAIT_MS`. |
| 45 | pub fn database_lock_wait() -> std::time::Duration { |
| 46 | std::env::var("ATOMIC_DB_LOCK_WAIT_MS") |
| 47 | .ok() |
| 48 | .and_then(|raw| raw.parse::<u64>().ok()) |
| 49 | .map_or( |
| 50 | std::time::Duration::from_secs(30), |
| 51 | std::time::Duration::from_millis, |
| 52 | ) |
| 53 | } |
| 54 | |
| 55 | /// Whether `dot_dir` holds a repository database in either layout. |
| 56 | pub fn has_database(dot_dir: &Path) -> bool { |