GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

JobWorker::getName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace Symbiote\QueuedJobs\Workers;
4
5
use SilverStripe\ORM\DataList;
6
use SilverStripe\ORM\FieldType\DBDatetime;
7
use Symbiote\QueuedJobs\DataObjects\QueuedJobDescriptor;
8
use Symbiote\QueuedJobs\Services\QueuedJobService;
9
10
/**
11
 * @author [email protected]
12
 * @license BSD License http://silverstripe.org/bsd-license/
13
 */
14
15
// GearmanHandler is an extension that could be not available.
16
/**
17
 * @todo Test and implement against it for SilverStripe 4.x compatibility
18
 */
19
if (interface_exists('GearmanHandler')) {
20
    class JobWorker implements \GearmanHandler
21
    {
22
        /**
23
         * @var QueuedJobService
24
         */
25
        public $queuedJobService;
26
27
        /**
28
         * @return string
29
         */
30
        public function getName()
31
        {
32
            return 'jobqueueExecute';
33
        }
34
35
        /**
36
         * @param int $jobId
37
         * @return void
38
         */
39
        public function jobqueueExecute($jobId)
40
        {
41
            $this->queuedJobService->checkJobHealth();
42
            $job = QueuedJobDescriptor::get()->byID($jobId);
43
            if ($job) {
44
                // check that we're not trying to execute something tooo soon
45
                if (strtotime($job->StartAfter) > DBDatetime::now()->getTimestamp()) {
46
                    return;
47
                }
48
49
                $this->queuedJobService->runJob($jobId);
50
            }
51
        }
52
    }
53
}
54