aboutsummaryrefslogtreecommitdiffstats
path: root/dashboard/app/api.go
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-06-07 16:11:45 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-06-08 09:34:02 +0200
commit1319a7da099fef01a21caa7c15bd98dcddd3acb3 (patch)
treee2d280925217d685ac5b27ffebb2f10f1371e430 /dashboard/app/api.go
parentf7b27b7a19fb3b0edf38d73146e4d9c66b819643 (diff)
dashboard/app: fix crash save throttling logic
bug.LastTime is updated on every crash, even if we don't save it. As the result we did not save recent crashes for popular bugs at all. Fix this by introducing bug.LastSavedCrash.
Diffstat (limited to 'dashboard/app/api.go')
-rw-r--r--dashboard/app/api.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/dashboard/app/api.go b/dashboard/app/api.go
index 4fdf117d7..f690ca348 100644
--- a/dashboard/app/api.go
+++ b/dashboard/app/api.go
@@ -519,9 +519,10 @@ func reportCrash(c context.Context, ns string, req *dashapi.Crash) (*Bug, error)
} else if len(req.ReproSyz) != 0 {
reproLevel = ReproLevelSyz
}
- saveCrash := bug.NumCrashes < maxCrashes ||
- now.Sub(bug.LastTime) > time.Hour ||
- reproLevel != ReproLevelNone
+ saveCrash := reproLevel != ReproLevelNone ||
+ bug.NumCrashes < maxCrashes ||
+ now.Sub(bug.LastSavedCrash) > time.Hour ||
+ bug.NumCrashes%20 == 0
if saveCrash {
// Reporting priority of this crash.
// Currently it is computed only from repository ReportingPriority and Arch,
@@ -566,6 +567,9 @@ func reportCrash(c context.Context, ns string, req *dashapi.Crash) (*Bug, error)
}
bug.NumCrashes++
bug.LastTime = now
+ if saveCrash {
+ bug.LastSavedCrash = now
+ }
if reproLevel != ReproLevelNone {
bug.NumRepro++
}
@@ -593,7 +597,7 @@ func reportCrash(c context.Context, ns string, req *dashapi.Crash) (*Bug, error)
}
func purgeOldCrashes(c context.Context, bug *Bug, bugKey *datastore.Key) {
- if bug.NumCrashes <= maxCrashes || bug.NumCrashes%10 != 0 {
+ if bug.NumCrashes-bug.NumRepro <= maxCrashes || (bug.NumCrashes-1)%10 != 0 {
return
}
var crashes []*Crash