aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksandr Nogikh <nogikh@google.com>2023-05-03 13:23:02 +0200
committerAleksandr Nogikh <wp32pw@gmail.com>2023-05-03 14:00:25 +0200
commitf3eb580f055be5b4df837069f28b0e72ad3a28b3 (patch)
tree7f71c3f9eee0097e3a0d09e2578ba5636fa7bbb1
parent48e0a81d77e80af7bdc154ef423accc74517f806 (diff)
dashboard: move common bug filtering to createPatchTestingJobs
-rw-r--r--dashboard/app/jobs.go18
-rw-r--r--dashboard/app/reporting.go12
2 files changed, 20 insertions, 10 deletions
diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go
index 7d172f68a..1c5dfad8d 100644
--- a/dashboard/app/jobs.go
+++ b/dashboard/app/jobs.go
@@ -342,6 +342,14 @@ func createPatchTestingJobs(c context.Context, managers map[string]dashapi.Manag
if err != nil {
return nil, nil, err
}
+ bugs, bugKeys = filterBugs(bugs, bugKeys, func(bug *Bug) bool {
+ if len(bug.Commits) > 0 {
+ // Let's save resources -- there's no point in doing analysis for bugs
+ // for which we were already given fixing commits.
+ return false
+ }
+ return true
+ })
r.Shuffle(len(bugs), func(i, j int) {
bugs[i], bugs[j] = bugs[j], bugs[i]
bugKeys[i], bugKeys[j] = bugKeys[j], bugKeys[i]
@@ -371,11 +379,6 @@ func createTreeTestJobs(c context.Context, bugs []*Bug, bugKeys []*db.Key,
if !config.Namespaces[bug.Namespace].FindBugOriginTrees {
continue
}
- if len(bug.Commits) > 0 {
- // Let's save resources -- there's no point in doing analysis for bugs
- // for which we were already given fixing commits.
- continue
- }
if timeNow(c).Before(bug.TreeTests.NextPoll) {
continue
}
@@ -410,11 +413,6 @@ func createPatchRetestingJobs(c context.Context, bugs []*Bug, bugKeys []*db.Key,
// Repro retesting is disabled for the namespace.
continue
}
- if len(bug.Commits) > 0 {
- // Let's save resources -- there's no point in retesting repros for bugs
- // for which we were already given fixing commits.
- continue
- }
if timeNow(c).Sub(bug.LastTime) < config.Obsoleting.ReproRetestPeriod {
// Also don't retest reproducers if crashes are still happening.
continue
diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go
index 98d7e884a..f72caacba 100644
--- a/dashboard/app/reporting.go
+++ b/dashboard/app/reporting.go
@@ -683,6 +683,18 @@ func foreachBug(c context.Context, filter func(*db.Query) *db.Query, fn func(bug
}
}
+func filterBugs(bugs []*Bug, keys []*db.Key, filter func(*Bug) bool) ([]*Bug, []*db.Key) {
+ var retBugs []*Bug
+ var retKeys []*db.Key
+ for i, bug := range bugs {
+ if filter(bug) {
+ retBugs = append(retBugs, bugs[i])
+ retKeys = append(retKeys, keys[i])
+ }
+ }
+ return retBugs, retKeys
+}
+
// reportingPollClosed is called by backends to get list of closed bugs.
func reportingPollClosed(c context.Context, ids []string) ([]string, error) {
idMap := make(map[string]bool, len(ids))