diff options
| -rw-r--r-- | dashboard/app/entities.go | 13 | ||||
| -rw-r--r-- | dashboard/app/jobs.go | 2 | ||||
| -rw-r--r-- | dashboard/app/reporting.go | 12 |
3 files changed, 16 insertions, 11 deletions
diff --git a/dashboard/app/entities.go b/dashboard/app/entities.go index eb065fcdb..0ac817535 100644 --- a/dashboard/app/entities.go +++ b/dashboard/app/entities.go @@ -388,6 +388,19 @@ func (bug *Bug) getCommitInfo(i int) Commit { return Commit{} } +func markCrashReported(c context.Context, crashID int64, bugKey *datastore.Key, now time.Time) error { + crash := new(Crash) + crashKey := datastore.NewKey(c, "Crash", "", crashID, bugKey) + if err := datastore.Get(c, crashKey, crash); err != nil { + return fmt.Errorf("failed to get reported crash %v: %v", crashID, err) + } + crash.Reported = now + if _, err := datastore.Put(c, crashKey, crash); err != nil { + return fmt.Errorf("failed to put reported crash %v: %v", crashID, err) + } + return nil +} + func kernelRepoInfo(build *Build) KernelRepo { return kernelRepoInfoRaw(build.Namespace, build.KernelRepo, build.KernelBranch) } diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go index 7427f05dd..5b0893f93 100644 --- a/dashboard/app/jobs.go +++ b/dashboard/app/jobs.go @@ -149,7 +149,7 @@ func addTestJob(c context.Context, bug *Bug, bugKey *datastore.Key, bugReporting if _, err := datastore.Put(c, jobKey, job); err != nil { return fmt.Errorf("failed to put job: %v", err) } - return nil + return markCrashReported(c, job.CrashID, bugKey, now) } err = datastore.RunInTransaction(c, tx, &datastore.TransactionOptions{XG: true, Attempts: 30}) if patchID != 0 && deletePatch || err != nil { 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 } |
