mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
fix: Check for job status on another incoming (#1117)
If a job silently failed, it wasn't possible for another one to execute. This fixes it by using the API status to return active state.
This commit is contained in:
@@ -25,6 +25,15 @@ type ProvisionerDaemon database.ProvisionerDaemon
|
||||
// ProvisionerJobStaus represents the at-time state of a job.
|
||||
type ProvisionerJobStatus string
|
||||
|
||||
// Active returns whether the job is still active or not.
|
||||
// It returns true if canceling as well, since the job isn't
|
||||
// in an entirely inactive state yet.
|
||||
func (p ProvisionerJobStatus) Active() bool {
|
||||
return p == ProvisionerJobPending ||
|
||||
p == ProvisionerJobRunning ||
|
||||
p == ProvisionerJobCanceling
|
||||
}
|
||||
|
||||
const (
|
||||
ProvisionerJobPending ProvisionerJobStatus = "pending"
|
||||
ProvisionerJobRunning ProvisionerJobStatus = "running"
|
||||
|
||||
Reference in New Issue
Block a user