diff options
Diffstat (limited to 'grasp-audit/src/client.rs')
| -rw-r--r-- | grasp-audit/src/client.rs | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/grasp-audit/src/client.rs b/grasp-audit/src/client.rs index 4831d3f..b80b59f 100644 --- a/grasp-audit/src/client.rs +++ b/grasp-audit/src/client.rs | |||
| @@ -24,11 +24,12 @@ impl AuditClient { | |||
| 24 | 24 | ||
| 25 | // Wait for connection to establish (with retries) | 25 | // Wait for connection to establish (with retries) |
| 26 | let mut attempts = 0; | 26 | let mut attempts = 0; |
| 27 | let mut connected = false; | ||
| 27 | while attempts < 20 { | 28 | while attempts < 20 { |
| 28 | tokio::time::sleep(Duration::from_millis(100)).await; | 29 | tokio::time::sleep(Duration::from_millis(100)).await; |
| 29 | 30 | ||
| 30 | let relays = client.relays().await; | 31 | let relays = client.relays().await; |
| 31 | let connected = relays.values().any(|r| r.is_connected()); | 32 | connected = relays.values().any(|r| r.is_connected()); |
| 32 | 33 | ||
| 33 | if connected { | 34 | if connected { |
| 34 | break; | 35 | break; |
| @@ -37,6 +38,25 @@ impl AuditClient { | |||
| 37 | attempts += 1; | 38 | attempts += 1; |
| 38 | } | 39 | } |
| 39 | 40 | ||
| 41 | // Verify we actually connected | ||
| 42 | if !connected { | ||
| 43 | return Err(anyhow!( | ||
| 44 | "Failed to connect to relay at '{}'\n\ | ||
| 45 | \n\ | ||
| 46 | Possible causes:\n\ | ||
| 47 | • Relay is not running at this address\n\ | ||
| 48 | • Network connectivity issues\n\ | ||
| 49 | • Incorrect URL or port\n\ | ||
| 50 | \n\ | ||
| 51 | To start ngit-relay for testing:\n\ | ||
| 52 | docker run --rm -p 18081:8081 ghcr.io/danconwaydev/ngit-relay:latest\n\ | ||
| 53 | \n\ | ||
| 54 | Or use the test script:\n\ | ||
| 55 | cd grasp-audit && ./test-ngit-relay.sh", | ||
| 56 | relay_url | ||
| 57 | )); | ||
| 58 | } | ||
| 59 | |||
| 40 | // Give it a bit more time to stabilize | 60 | // Give it a bit more time to stabilize |
| 41 | tokio::time::sleep(Duration::from_millis(200)).await; | 61 | tokio::time::sleep(Duration::from_millis(200)).await; |
| 42 | 62 | ||