diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2022-08-11 18:07:35 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2022-08-26 12:33:44 +0200 |
| commit | ae7ef8be831892da91b059337920c5db86941580 (patch) | |
| tree | 153d86b1525d168c7ed51ad9960a79fcf522657b | |
| parent | 256f7db0800ef141bb06578df61f4d21b8251eff (diff) | |
dashboard/app: prioritize user-initiated jobs
| -rw-r--r-- | dashboard/app/jobs.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/dashboard/app/jobs.go b/dashboard/app/jobs.go index 518d05396..1a3bf20a5 100644 --- a/dashboard/app/jobs.go +++ b/dashboard/app/jobs.go @@ -6,6 +6,7 @@ package main import ( "encoding/json" "fmt" + "sort" "strconv" "strings" "time" @@ -977,7 +978,10 @@ func loadPendingJob(c context.Context, managers map[string]dashapi.ManagerJobs) if err != nil { return nil, nil, fmt.Errorf("failed to query jobs: %v", err) } - // TODO: prioritize user-initiated jobs. + // Give priority to user-initiated jobs to reduce the perceived processing time. + sort.SliceStable(jobs, func(i, j int) bool { + return jobs[i].User != "" && jobs[j].User == "" + }) for i, job := range jobs { switch job.Type { case JobTestPatch: |
