From cccbb0bd5e122a168884dc02912d0d23dc34a60c Mon Sep 17 00:00:00 2001 From: Simon Frei Date: Sat, 28 Nov 2020 20:09:22 +0100 Subject: [PATCH] lib/ur: Reset timer when there's nothing to report (#7169) --- cmd/stcrashreceiver/main.go | 5 ++++- cmd/stcrashreceiver/stcrashreceiver.go | 2 +- lib/ur/failurereporting.go | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cmd/stcrashreceiver/main.go b/cmd/stcrashreceiver/main.go index 5e6da5a4b..c7fb09b31 100644 --- a/cmd/stcrashreceiver/main.go +++ b/cmd/stcrashreceiver/main.go @@ -74,6 +74,7 @@ func handleFailureFn(dsn string) func(w http.ResponseWriter, req *http.Request) } if len(reports) == 0 { // Shouldn't happen + log.Printf("Got zero failure reports") return } @@ -91,7 +92,9 @@ func handleFailureFn(dsn string) func(w http.ResponseWriter, req *http.Request) pkt.Fingerprint = []string{r.Description} if err := sendReport(dsn, pkt, userIDFor(req)); err != nil { - log.Println("Failed to send crash report:", err) + log.Println("Failed to send failure report:", err) + } else { + log.Println("Sent failure report:", r.Description) } } } diff --git a/cmd/stcrashreceiver/stcrashreceiver.go b/cmd/stcrashreceiver/stcrashreceiver.go index dc7202274..9a39296c1 100644 --- a/cmd/stcrashreceiver/stcrashreceiver.go +++ b/cmd/stcrashreceiver/stcrashreceiver.go @@ -130,7 +130,7 @@ func (r *crashReceiver) servePut(reportID, fullPath string, w http.ResponseWrite return } if err := sendReport(r.dsn, pkt, user); err != nil { - log.Println("Failed to send crash report:", err) + log.Println("Failed to send crash report:", err) } }() } diff --git a/lib/ur/failurereporting.go b/lib/ur/failurereporting.go index 92de0fdc9..942a9f601 100644 --- a/lib/ur/failurereporting.go +++ b/lib/ur/failurereporting.go @@ -133,6 +133,8 @@ outer: case <-ctx.Done(): } }() + } else { + timer.Reset(minDelay) } case <-resetTimer: timer.Reset(minDelay)