fix(coder-lite): correct --dev health check path and wait longer

6a7d96d0b582 · AtlantisPleb · · parent 0d6ebd0be6d6

fix(coder-lite): correct --dev health check path and wait longer

`is_dev_server_up` was probing `GET /api/v1/health`, but the dev server
serves health at `/health`. It now hits the right path and polls for 300
* 500ms (150s) so the first `mix phx.server` compile has time to finish.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>

Deploy story

What this commit did to the running system — joined from the forge receipt chain, the part a commit page elsewhere cannot show.

Not deployed through the forge lane

No push, promotion, build, or deploy receipt references this commit (receipts are scanned over a bounded recent window). Changes shipped by full node replacement carry their proof in the release gate receipt instead.

Changed files

  • modified crates/coder-lite/src/main.rs

Diff

1 file changed, +4 -4

crates/coder-lite/src/main.rs modified +4 -4

@@ -167,20 +167,20 @@ async fn boot_dev_server() -> Result<(), Box<dyn std::error::Error>> {

167 167
    command.process_group(0);
168 168
    let _child = command.spawn()?;
169 169
170
    for _ in 0..60 {
170
    for _ in 0..300 {
171 171
        if is_dev_server_up().await {
172 172
            return Ok(());
173 173
        }
174
        sleep(Duration::from_secs(1)).await;
174
        sleep(Duration::from_millis(500)).await;
175 175
    }
176 176
177
    Err("dev server did not become ready in 60 seconds".into())
177
    Err("dev server did not become ready in 150 seconds".into())
178 178
}
179 179
180 180
async fn is_dev_server_up() -> bool {
181 181
    timeout(Duration::from_secs(2), async {
182 182
        let mut stream = TcpStream::connect("127.0.0.1:4000").await.ok()?;
183
        let request = "GET /api/v1/health HTTP/1.1\r\nHost: 127.0.0.1:4000\r\nConnection: close\r\n\r\n";
183
        let request = "GET /health HTTP/1.1\r\nHost: 127.0.0.1:4000\r\nConnection: close\r\n\r\n";
184 184
        stream.write_all(request.as_bytes()).await.ok()?;
185 185
        let mut buf = [0u8; 256];
186 186
        let n = stream.read(&mut buf).await.ok()?;

This page updates live while a promote is in flight · changelog