aboutsummaryrefslogtreecommitdiffstats
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
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.
-rw-r--r--dashboard/app/api.go12
-rw-r--r--dashboard/app/entities.go33
2 files changed, 25 insertions, 20 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
diff --git a/dashboard/app/entities.go b/dashboard/app/entities.go
index dbff67753..0f4b604e7 100644
--- a/dashboard/app/entities.go
+++ b/dashboard/app/entities.go
@@ -65,22 +65,23 @@ type Build struct {
}
type Bug struct {
- Namespace string
- Seq int64 // sequences of the bug with the same title
- Title string
- Status int
- DupOf string
- NumCrashes int64
- NumRepro int64
- ReproLevel dashapi.ReproLevel
- HasReport bool
- FirstTime time.Time
- LastTime time.Time
- Closed time.Time
- Reporting []BugReporting
- Commits []string
- HappenedOn []string `datastore:",noindex"` // list of managers
- PatchedOn []string `datastore:",noindex"` // list of managers
+ Namespace string
+ Seq int64 // sequences of the bug with the same title
+ Title string
+ Status int
+ DupOf string
+ NumCrashes int64
+ NumRepro int64
+ ReproLevel dashapi.ReproLevel
+ HasReport bool
+ FirstTime time.Time
+ LastTime time.Time
+ LastSavedCrash time.Time
+ Closed time.Time
+ Reporting []BugReporting
+ Commits []string
+ HappenedOn []string `datastore:",noindex"` // list of managers
+ PatchedOn []string `datastore:",noindex"` // list of managers
}
type BugReporting struct {