| @@ 188-199 (lines=12) @@ | ||
| 185 | * |
|
| 186 | * @return bool |
|
| 187 | */ |
|
| 188 | public function canRunTask() |
|
| 189 | { |
|
| 190 | $this->refreshDescriptor(); |
|
| 191 | return in_array( |
|
| 192 | $this->descriptor->JobStatus, |
|
| 193 | array( |
|
| 194 | QueuedJob::STATUS_NEW, |
|
| 195 | QueuedJob::STATUS_INIT, |
|
| 196 | QueuedJob::STATUS_WAIT |
|
| 197 | ) |
|
| 198 | ); |
|
| 199 | } |
|
| 200 | ||
| 201 | /** |
|
| 202 | * @inheritdoc |
|
| @@ 206-217 (lines=12) @@ | ||
| 203 | * |
|
| 204 | * @return bool |
|
| 205 | */ |
|
| 206 | public function isCancelled() |
|
| 207 | { |
|
| 208 | $this->refreshDescriptor(); |
|
| 209 | ||
| 210 | // Treat completed jobs as cancelled when it comes to how Doorman handles picking up jobs to run |
|
| 211 | $cancelledStates = [ |
|
| 212 | QueuedJob::STATUS_CANCELLED, |
|
| 213 | QueuedJob::STATUS_COMPLETE, |
|
| 214 | ]; |
|
| 215 | ||
| 216 | return in_array($this->descriptor->JobStatus, $cancelledStates, true); |
|
| 217 | } |
|
| 218 | } |
|
| 219 | ||