Fix builds worker trying to update documents that don't exist

This commit is contained in:
Jake Barnby 2023-08-23 00:43:23 -04:00
parent c30b5b1a77
commit 0639ac1ab3
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -391,6 +391,12 @@ class BuildsV1 extends Worker
projectId: $project->getId(),
callback: function ($logs) use (&$response, &$build, $dbForProject, $allEvents, $project) {
if ($response === null) {
$build = $dbForProject->getDocument('builds', $build->getId());
if ($build->isEmpty()) {
throw new Exception('Build not found', 404);
}
$build = $build->setAttribute('logs', $build->getAttribute('logs', '') . $logs);
$build = $dbForProject->updateDocument('builds', $build->getId(), $build);