Fix build execute - in some cases one build executed with many process
This commit is contained in:
parent
37abf496d2
commit
80aa7d4c06
6 changed files with 114 additions and 26 deletions
|
|
@ -175,8 +175,16 @@ class Builder implements LoggerAwareInterface
|
|||
*/
|
||||
public function execute()
|
||||
{
|
||||
// check current status
|
||||
if ($this->build->getStatus() != Build::STATUS_PENDING) {
|
||||
throw new BuilderException('Can`t build - status is not pending', BuilderException::FAIL_START);
|
||||
}
|
||||
// set status only if current status pending
|
||||
if (!$this->build->setStatusSync(Build::STATUS_RUNNING)) {
|
||||
throw new BuilderException('Can`t build - unable change status to running', BuilderException::FAIL_START);
|
||||
}
|
||||
|
||||
// Update the build in the database, ping any external services.
|
||||
$this->build->setStatus(Build::STATUS_RUNNING);
|
||||
$this->build->setStarted(new \DateTime());
|
||||
$this->store->save($this->build);
|
||||
$this->build->sendStatusPostback();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue