feat: catch docker remove errors elegantly

This commit is contained in:
Christy Jacob
2022-02-06 14:00:44 +04:00
parent dea2873845
commit 6ab1095280
3 changed files with 14 additions and 13 deletions
+3 -3
View File
@@ -63,7 +63,7 @@ class Executor
return $response['body'];
}
public function deleteRuntime(string $deploymentId, string $projectId)
public function deleteRuntime(string $deploymentId, array $buildIds, string $projectId)
{
$route = "/deployments/$deploymentId";
$headers = [
@@ -72,14 +72,14 @@ class Executor
'x-appwrite-executor-key' => App::getEnv('_APP_EXECUTOR_SECRET', '')
];
$params = [
'buildIds' => $buildIds[$deploymentId] ?? [],
'buildIds' => $buildIds,
];
$response = $this->call(self::METHOD_DELETE, $route, $headers, $params, true, 30);
$status = $response['headers']['status-code'];
if ($status >= 400) {
throw new \Exception('Error deleting deplyoment: ' . $deploymentId , $status);
throw new \Exception('Error deleting deployment: ' . $deploymentId , $status);
}
return $response['body'];