1
0
Fork 0
mirror of synced 2024-05-20 12:42:39 +12:00

feat(events): update build event reset to reset everything

Instead of using setType('') to prevent events from triggering, it
makes more sense to use reset(). However, reset() didn't properly
reset type, resource, deployment, or template. This change makes
sure to reset all those private variables.
This commit is contained in:
Steven Nguyen 2024-03-11 11:17:40 +01:00
parent b9b891a90b
commit b19efb619b
No known key found for this signature in database
2 changed files with 17 additions and 1 deletions

View file

@ -254,7 +254,7 @@ $createGitDeployments = function (GitHub $github, string $providerInstallationId
}
}
$queueForBuilds->setType(''); // prevent shutdown hook from triggering again
$queueForBuilds->reset(); // prevent shutdown hook from triggering again
if (!empty($errors)) {
throw new Exception(Exception::GENERAL_UNKNOWN, \implode("\n", $errors));

View file

@ -122,4 +122,20 @@ class Build extends Event
'template' => $this->template
]);
}
/**
* Resets event.
*
* @return self
*/
public function reset(): self
{
$this->type = '';
$this->resource = null;
$this->deployment = null;
$this->template = null;
parent::reset();
return $this;
}
}