Read the daemon wait timeout from `DAEMON_WAIT_TIMEOUT_SECS`, defaulting to 5.
()
| 22 | |
| 23 | /// Read the daemon wait timeout from `DAEMON_WAIT_TIMEOUT_SECS`, defaulting to 5. |
| 24 | fn daemon_wait_timeout() -> Duration { |
| 25 | std::env::var("DAEMON_WAIT_TIMEOUT_SECS") |
| 26 | .ok() |
| 27 | .and_then(|v| v.parse::<u64>().ok()) |
| 28 | .map(Duration::from_secs) |
| 29 | .unwrap_or(Duration::from_secs(5)) |
| 30 | } |
| 31 | |
| 32 | /// Try to send a request to the daemon. Returns error if daemon is not running. |
| 33 | pub async fn send_to_daemon(request: &DaemonRequest) -> Result<DaemonResponse> { |