From 5cf6e34d9e776fa906088beff75fa93b4e3681c2 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Tue, 12 Mar 2019 13:23:20 +0100 Subject: dashboard/app: add markCrashReported helper Factor out markCrashReported out of incomingCommandTx. Use it when creating patch testing jobs. Will be needed for bisection jobs as well. Update #501 --- dashboard/app/reporting.go | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'dashboard/app/reporting.go') diff --git a/dashboard/app/reporting.go b/dashboard/app/reporting.go index a75372413..461605721 100644 --- a/dashboard/app/reporting.go +++ b/dashboard/app/reporting.go @@ -619,16 +619,8 @@ func incomingCommandTx(c context.Context, now time.Time, cmd *dashapi.BugUpdate, } if cmd.CrashID != 0 { // Rememeber that we've reported this crash. - crash := new(Crash) - crashKey := datastore.NewKey(c, "Crash", "", cmd.CrashID, bugKey) - if err := datastore.Get(c, crashKey, crash); err != nil { - return false, internalError, fmt.Errorf("failed to get reported crash %v: %v", - cmd.CrashID, err) - } - crash.Reported = now - if _, err := datastore.Put(c, crashKey, crash); err != nil { - return false, internalError, fmt.Errorf("failed to put reported crash %v: %v", - cmd.CrashID, err) + if err := markCrashReported(c, cmd.CrashID, bugKey, now); err != nil { + return false, internalError, err } bugReporting.CrashID = cmd.CrashID } -- cgit mrf-deployment