Skip to content

Commit

Permalink
Only call /workers/all once, rather than for each worker pool (#251)
Browse files Browse the repository at this point in the history
Dont need to make extra calls - its a global call, not a per worker pool call
  • Loading branch information
matt-richardson authored Apr 13, 2020
1 parent 9462c3f commit 95acd6f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions OctopusDSC/DSCResources/cTentacleAgent/cTentacleAgent.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ function Get-WorkerPoolMembership {
$octoWorkerPools = Get-APIResult -ServerUrl $ServerUrl -ApiKey $ApiKey -API $apiUrl

$workerPoolMembership = @()
$workersUrl = "/workers/all"
if (![String]::IsNullOrEmpty($SpaceId)) {
$workersUrl = "/$SpaceId" + $workersUrl
}
$workersall = Get-APIResult -ServerUrl $ServerUrl -ApiKey $ApiKey -API $workersUrl

foreach ($octoWorkerPool in $octoWorkerPools) {
$workersUrl = "/workers/all"
if (![String]::IsNullOrEmpty($SpaceId)) {
$workersUrl = "/$SpaceId" + $workersUrl
}
$workersall = Get-APIResult -ServerUrl $ServerUrl -ApiKey $ApiKey -API $workersUrl
$workers = $workersall | Where-Object { $_.WorkerPoolIds -contains $($octoWorkerPool.Id) }
# Check to see if the thumbprint is listed
$workerWithThumbprint = ($workers | Where-Object {$_.Thumbprint -eq $Thumbprint})
Expand Down

0 comments on commit 95acd6f

Please sign in to comment.