Skip to content

Commit

Permalink
Adding fatal error log in monitor Handler for unhandled errors
Browse files Browse the repository at this point in the history
  • Loading branch information
alexcottner committed Sep 19, 2024
1 parent 3b78727 commit 80fe6b3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions tools/autograph-monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,7 @@ func main() {
} else {
err := Handler()
if err != nil {
fmt.Fprintf(os.Stderr, "error: %v\n", err)
os.Exit(1)
log.Fatalf("Unhandled exception from monitor: %s", err)
}
os.Exit(0)
}
Expand Down Expand Up @@ -128,7 +127,11 @@ func Handler() (err error) {
// force gc run
// https://bugzilla.mozilla.org/show_bug.cgi?id=1621133
t1 := time.Now()

runtime.GC()
if err != nil {
log.Fatalf("Unhandled error on monitor Handler: %s", err)
}
log.Println("Garbage collected in", time.Since(t1))
}()
return monitor()
Expand Down

0 comments on commit 80fe6b3

Please sign in to comment.