Skip to content

Commit

Permalink
Fix environments listing by ID
Browse files Browse the repository at this point in the history
  • Loading branch information
pjcdawkins committed Sep 17, 2024
1 parent 8f3b65b commit 837fff6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Service/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -745,13 +745,14 @@ public function getEnvironments(Project $project, $refresh = null, $events = tru
if ($refresh === false && !$cached) {
return [];
} elseif ($refresh || !$cached) {
$toCache = [];

// Fetch environments with double the default timeout.
$environments = Environment::getCollection($project->getLink('environments'), 0, [
$list = Environment::getCollection($project->getLink('environments'), 0, [
'timeout' => 2 * $this->config->getWithDefault('api.default_timeout', 30),
], $this->getHttpClient());
foreach ($environments as $environment) {
$environments = [];
$toCache = [];
foreach ($list as $environment) {
// Key the list by ID.
$environments[$environment->id] = $environment;
$toCache[$environment->id] = $environment->getData();
}
Expand Down

0 comments on commit 837fff6

Please sign in to comment.