Skip to content

Commit

Permalink
perf: don't loop the users without any provisioning configurations
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Kesselberg <[email protected]>
  • Loading branch information
kesselb committed Sep 3, 2024
1 parent 0eb8161 commit 8045989
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions lib/Service/Provisioning/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,20 @@ public function getConfigs(): array {
}

public function provision(): int {
$cnt = 0;
$counter = 0;

$configs = $this->getConfigs();
$this->userManager->callForAllUsers(function (IUser $user) use ($configs, &$cnt) {
if ($this->provisionSingleUser($configs, $user) === true) {
$cnt++;
if (count($configs) === 0) {
return $counter;
}

$this->userManager->callForAllUsers(function (IUser $user) use ($configs, &$counter) {
if ($this->provisionSingleUser($configs, $user)) {
$counter++;
}
});
return $cnt;

return $counter;
}

/**
Expand Down

0 comments on commit 8045989

Please sign in to comment.