lib/ur: Reset timer when there's nothing to report (#7169)

This commit is contained in:
Simon Frei
2020-11-28 20:09:22 +01:00
committed by GitHub
parent 240ae0c14f
commit cccbb0bd5e
3 changed files with 7 additions and 2 deletions
+4 -1
View File
@@ -74,6 +74,7 @@ func handleFailureFn(dsn string) func(w http.ResponseWriter, req *http.Request)
} }
if len(reports) == 0 { if len(reports) == 0 {
// Shouldn't happen // Shouldn't happen
log.Printf("Got zero failure reports")
return return
} }
@@ -91,7 +92,9 @@ func handleFailureFn(dsn string) func(w http.ResponseWriter, req *http.Request)
pkt.Fingerprint = []string{r.Description} pkt.Fingerprint = []string{r.Description}
if err := sendReport(dsn, pkt, userIDFor(req)); err != nil { 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)
} }
} }
} }
+1 -1
View File
@@ -130,7 +130,7 @@ func (r *crashReceiver) servePut(reportID, fullPath string, w http.ResponseWrite
return return
} }
if err := sendReport(r.dsn, pkt, user); err != nil { 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)
} }
}() }()
} }
+2
View File
@@ -133,6 +133,8 @@ outer:
case <-ctx.Done(): case <-ctx.Done():
} }
}() }()
} else {
timer.Reset(minDelay)
} }
case <-resetTimer: case <-resetTimer:
timer.Reset(minDelay) timer.Reset(minDelay)