diff --git a/daemon.go b/daemon.go index 96b76aa..30cbf29 100644 --- a/daemon.go +++ b/daemon.go @@ -26,10 +26,6 @@ type DaemonOptions struct { // HealthChecks are additional health check functions. HealthChecks []HealthCheck - - // OnReload is called when SIGHUP is received. - // Use for config reloading. Leave nil to ignore SIGHUP. - OnReload func() error } // Daemon manages daemon lifecycle: PID file, health server, graceful shutdown. @@ -135,7 +131,7 @@ func (d *Daemon) Stop() error { d.running = false if len(errs) > 0 { - return fmt.Errorf("shutdown errors: %v", errs) + return errors.Join(errs...) } return nil } diff --git a/health.go b/health.go index bf7a1cd..0f8563a 100644 --- a/health.go +++ b/health.go @@ -117,8 +117,10 @@ func WaitForHealth(addr string, timeoutMs int) bool { deadline := time.Now().Add(time.Duration(timeoutMs) * time.Millisecond) url := fmt.Sprintf("http://%s/health", addr) + client := &http.Client{Timeout: 2 * time.Second} + for time.Now().Before(deadline) { - resp, err := http.Get(url) + resp, err := client.Get(url) if err == nil { resp.Body.Close() if resp.StatusCode == http.StatusOK {