From 46a1430596ca4a4bbd2ac268b35da24938a66094 Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Thu, 11 May 2023 16:52:41 +0200 Subject: dashboard: refactor currentReporting invocations The method doesn't need context.Context. --- dashboard/app/jobs.go | 2 +- dashboard/app/reporting.go | 8 ++++---- dashboard/app/reporting_email.go | 2 +- dashboard/app/reporting_lists.go | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go index 6ca7ddd16..3ad25ad07 100644 --- a/dashboard/app/jobs.go +++ b/dashboard/app/jobs.go @@ -1025,7 +1025,7 @@ func updateBugBisection(c context.Context, job *Job, jobKey *db.Key, req *dashap if _, err := db.Put(c, bugKey, bug); err != nil { return fmt.Errorf("failed to put bug: %v", err) } - _, bugReporting, _, _, _ := currentReporting(c, bug) + _, bugReporting, _, _, _ := currentReporting(bug) // The bug is either already closed or not yet reported in the current reporting, // either way we don't need to report it. If it wasn't reported, it will be reported // with the bisection results. diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go index b1a44e7f4..6f30b6216 100644 --- a/dashboard/app/reporting.go +++ b/dashboard/app/reporting.go @@ -95,7 +95,7 @@ func handleReportBug(c context.Context, typ string, state *ReportingState, bug * func needReport(c context.Context, typ string, state *ReportingState, bug *Bug) ( reporting *Reporting, bugReporting *BugReporting, reportingIdx int, status, link string, err error) { - reporting, bugReporting, reportingIdx, status, err = currentReporting(c, bug) + reporting, bugReporting, reportingIdx, status, err = currentReporting(bug) if err != nil || reporting == nil { return } @@ -186,7 +186,7 @@ func reportingPollNotifications(c context.Context, typ string) []*dashapi.BugNot } func handleReportNotif(c context.Context, typ string, bug *Bug) (*dashapi.BugNotification, error) { - reporting, bugReporting, _, _, err := currentReporting(c, bug) + reporting, bugReporting, _, _, err := currentReporting(bug) if err != nil || reporting == nil { return nil, nil } @@ -339,7 +339,7 @@ func createNotification(c context.Context, typ dashapi.BugNotif, public bool, te return notif, nil } -func currentReporting(c context.Context, bug *Bug) (*Reporting, *BugReporting, int, string, error) { +func currentReporting(bug *Bug) (*Reporting, *BugReporting, int, string, error) { if bug.NumCrashes == 0 { // This is possible during the short window when we already created a bug, // but did not attach the first crash to it yet. We need to avoid reporting this bug yet @@ -1331,7 +1331,7 @@ func loadFullBugInfo(c context.Context, bug *Bug, bugKey *db.Key, return nil, err } for _, similarBug := range similar { - _, bugReporting, _, _, _ := currentReporting(c, similarBug) + _, bugReporting, _, _, _ := currentReporting(similarBug) if bugReporting == nil { continue } diff --git a/dashboard/app/reporting_email.go b/dashboard/app/reporting_email.go index 257b41a0d..7398a0c5b 100644 --- a/dashboard/app/reporting_email.go +++ b/dashboard/app/reporting_email.go @@ -1090,7 +1090,7 @@ func matchBugFromList(c context.Context, sender, subject string) (*bugInfoResult log.Infof(c, "access denied") continue } - reporting, bugReporting, _, _, err := currentReporting(c, bug) + reporting, bugReporting, _, _, err := currentReporting(bug) if err != nil || reporting == nil { log.Infof(c, "could not query reporting: %s", err) continue diff --git a/dashboard/app/reporting_lists.go b/dashboard/app/reporting_lists.go index 4b624fd19..b8cc15d2b 100644 --- a/dashboard/app/reporting_lists.go +++ b/dashboard/app/reporting_lists.go @@ -249,7 +249,7 @@ func querySubsystemReport(c context.Context, subsystem *Subsystem, reporting *Re } withRepro, noRepro := []*Bug{}, []*Bug{} for _, bug := range rawOpenBugs { - currReporting, _, _, _, _ := currentReporting(c, bug) + currReporting, _, _, _, _ := currentReporting(bug) if reporting.Name != currReporting.Name { // The big is not at the expected reporting stage. continue @@ -366,7 +366,7 @@ func queryMatchingBugs(c context.Context, ns, name string, accessLevel AccessLev fixed = append(fixed, bug) continue } - currReporting, _, _, _, err := currentReporting(c, bug) + currReporting, _, _, _, err := currentReporting(bug) if err != nil { continue } -- cgit mrf-deployment