Renamed app config worker section to queue + removed max_jobs option (use supervisord)
This commit is contained in:
parent
b5e96aa94c
commit
0ca5c8de51
5 changed files with 15 additions and 46 deletions
|
|
@ -25,13 +25,6 @@ class BuildWorker
|
|||
*/
|
||||
protected $run = true;
|
||||
|
||||
/**
|
||||
* The maximum number of jobs this worker should run before exiting.
|
||||
* Use -1 for no limit.
|
||||
* @var int
|
||||
*/
|
||||
protected $maxJobs = -1;
|
||||
|
||||
/**
|
||||
* The logger for builds to use.
|
||||
* @var \Monolog\Logger
|
||||
|
|
@ -71,14 +64,6 @@ class BuildWorker
|
|||
$this->pheanstalk = new Pheanstalk($this->host);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $maxJobs
|
||||
*/
|
||||
public function setMaxJobs($maxJobs = -1)
|
||||
{
|
||||
$this->maxJobs = $maxJobs;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Logger $logger
|
||||
*/
|
||||
|
|
@ -100,8 +85,6 @@ class BuildWorker
|
|||
// Get a job from the queue:
|
||||
$job = $this->pheanstalk->reserve();
|
||||
|
||||
$this->checkJobLimit();
|
||||
|
||||
// Get the job data and run the job:
|
||||
$jobData = json_decode($job->getData(), true);
|
||||
|
||||
|
|
@ -169,20 +152,6 @@ class BuildWorker
|
|||
$this->run = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this worker has done the amount of jobs it is allowed to do, and if so tells it to stop
|
||||
* after this job completes.
|
||||
*/
|
||||
protected function checkJobLimit()
|
||||
{
|
||||
// Make sure we don't run more than maxJobs jobs on this worker:
|
||||
$this->totalJobs++;
|
||||
|
||||
if ($this->maxJobs != -1 && $this->maxJobs <= $this->totalJobs) {
|
||||
$this->stopWorker();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks that the job received is actually from PHPCI, and has a valid type.
|
||||
* @param Job $job
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue