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
|
|
@ -310,4 +310,24 @@ class BuildStore extends Store
|
|||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update status only if it synced with db
|
||||
* @param Build $build
|
||||
* @param int $status
|
||||
* @return bool
|
||||
*/
|
||||
public function updateStatusSync($build, $status)
|
||||
{
|
||||
try {
|
||||
$query = 'UPDATE {{build}} SET status = :status_new WHERE {{id}} = :id AND {{status}} = :status_current';
|
||||
$stmt = Database::getConnection('write')->prepareCommon($query);
|
||||
$stmt->bindValue(':id', $build->getId(), \PDO::PARAM_INT);
|
||||
$stmt->bindValue(':status_current', $build->getStatus(), \PDO::PARAM_INT);
|
||||
$stmt->bindValue(':status_new', $status, \PDO::PARAM_INT);
|
||||
return ($stmt->execute() and ($stmt->rowCount() == 1));
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue