Fixing daemonise mode, forcing RunCommand to only get one build at a time when running under daemon mode

This commit is contained in:
Dan Cryer 2014-05-06 16:43:47 +01:00
parent ca6890a5c3
commit d69ffe0dc1
2 changed files with 13 additions and 3 deletions

View file

@ -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());

View file

@ -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;
}
}