Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions packages/sandbox/daemon-go/internal/probe/probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ type State struct {
Status string
Port int
HtmlSupport bool
// HTTPStatus is the status code of the last successful probe request, or 0
// when nothing answered. A dev server that answers every request with 5xx
// is reachable but useless — `Status` alone cannot tell those apart, and a
// warm-pool pod handed over with a half-built framework directory looks
// perfectly online without this.
HTTPStatus int
}

type Deps struct {
Expand Down Expand Up @@ -137,7 +131,7 @@ func (p *Prober) tick() {
}
if up {
p.consecutiveFailures = 0
next := State{Status: StatusOnline, Port: p.state.Port, HtmlSupport: isHtml, HTTPStatus: status}
next := State{Status: StatusOnline, Port: p.state.Port, HtmlSupport: isHtml}
prevStatus := p.state.Status
p.applyLocked(next)
if prevStatus == StatusBooting && p.deps.OnLog != nil {
Expand Down
66 changes: 0 additions & 66 deletions packages/sandbox/daemon-go/internal/probe/probe_status_test.go

This file was deleted.

19 changes: 1 addition & 18 deletions packages/sandbox/daemon-go/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,6 @@ func envDuration(name string, def, min time.Duration) time.Duration {
return def
}

// restartOn5xx gates treating an all-5xx dev server as dead. Default off: a
// user's app can legitimately 5xx from its own bug, and restarting that fixes
// nothing, so this ships dormant and is enabled per-deployment.
func restartOn5xx() bool {
v := strings.ToLower(strings.TrimSpace(os.Getenv("DEV_RESTART_ON_5XX")))
return v == "1" || v == "true"
}

// envInt reads an int from env, clamped to at least min, def when unset/bad.
func envInt(name string, def, min int) int {
if v := os.Getenv(name); v != "" {
Expand Down Expand Up @@ -492,16 +484,7 @@ func (d *daemon) devWatchTick() {
portKnown := sniffed != 0 || lastRunning != 0
// Read synchronously, not via a mirror an out-of-order callback could
// leave stale (see probe.Prober.Current).
probeState := d.prober.Current()
serving := probeState.Status == probe.StatusOnline
if serving && restartOn5xx() && probeState.HTTPStatus >= 500 {
// Reachable but serving nothing usable. A warm-pool pod has been handed
// over with a half-built framework directory (every route 5xx) and the
// watchdog sat it out, because "answered the request" was the whole
// liveness test. Treating that as dead lets the existing grace window
// and MaxRestarts budget rebuild it exactly once.
serving = false
}
serving := d.prober.Current().Status == probe.StatusOnline

d.devWatchMu.Lock()
action := d.devTracker.Observe(devwatch.Snapshot{
Expand Down
Loading