Fix build execute - in some cases one build executed with many process

This commit is contained in:
Stepan Strelets 2017-04-04 23:12:20 +03:00
commit 80aa7d4c06
6 changed files with 114 additions and 26 deletions

View file

@ -410,6 +410,27 @@ class Build extends Model
$this->setModified('status');
}
/**
* Set the value of Status / status only if it synced with db. Must not be null.
*
* @param $value int
* @return bool
*/
public function setStatusSync($value)
{
$this->validateNotNull('Status', $value);
$this->validateInt('Status', $value);
if ($this->data['status'] !== $value) {
$store = Factory::getStore('Build');
if ($store->updateStatusSync($this, $value)) {
$this->data['status'] = $value;
return true;
}
}
return false;
}
/**
* Set the value of Log / log.
*