Fixing daemonise mode, forcing RunCommand to only get one build at a time when running under daemon mode
This commit is contained in:
parent
9379af8724
commit
77daef3a5f
|
@ -76,6 +76,7 @@ class DaemoniseCommand extends Command
|
|||
$this->run = true;
|
||||
$this->sleep = 0;
|
||||
$runner = new RunCommand($this->logger);
|
||||
$runner->setBaxBuilds(1);
|
||||
|
||||
$emptyInput = new ArgvInput(array());
|
||||
|
||||
|
|
|
@ -42,6 +42,11 @@ class RunCommand extends Command
|
|||
*/
|
||||
protected $logger;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $maxBuilds = null;
|
||||
|
||||
/**
|
||||
* @param \Monolog\Logger $logger
|
||||
* @param string $name
|
||||
|
@ -52,7 +57,6 @@ class RunCommand extends Command
|
|||
$this->logger = $logger;
|
||||
}
|
||||
|
||||
|
||||
protected function configure()
|
||||
{
|
||||
$this
|
||||
|
@ -69,7 +73,7 @@ class RunCommand extends Command
|
|||
|
||||
// For verbose mode we want to output all informational and above
|
||||
// messages to the symphony output interface.
|
||||
if ($input->getOption('verbose')) {
|
||||
if ($input->hasOption('verbose')) {
|
||||
$this->logger->pushHandler(
|
||||
new OutputLogHandler($this->output, Logger::INFO)
|
||||
);
|
||||
|
@ -79,7 +83,7 @@ class RunCommand extends Command
|
|||
|
||||
$this->logger->addInfo("Finding builds to process");
|
||||
$store = Factory::getStore('Build');
|
||||
$result = $store->getByStatus(0);
|
||||
$result = $store->getByStatus(0, $this->maxBuilds);
|
||||
$this->logger->addInfo(sprintf("Found %d builds", count($result['items'])));
|
||||
|
||||
$builds = 0;
|
||||
|
@ -113,4 +117,9 @@ class RunCommand extends Command
|
|||
|
||||
return $builds;
|
||||
}
|
||||
|
||||
public function setBaxBuilds($numBuilds)
|
||||
{
|
||||
$this->maxBuilds = (int)$numBuilds;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue