Skip to content

Commit b6a630b

Browse files
committed
gateway: Return 0 for uptime on error
Returns 0 as the uptime in seconds if host info can't be retrieved. Previously, this was causing a fatal error when run locally on my Mac.
1 parent d9841cc commit b6a630b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/internal/gateway/gateway.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,10 @@ func (g *Gateway) handleInfoEndpoint(w http.ResponseWriter, r *http.Request) {
186186
}
187187

188188
func uptimeInSeconds() int64 {
189-
hostStats, _ := host.Info()
189+
hostStats, err := host.Info()
190+
if err != nil {
191+
return 0
192+
}
190193
return int64(hostStats.Uptime)
191194
}
192195

0 commit comments

Comments
 (0)