diff options
author | Louis Chemineau <louis@chmn.me> | 2025-03-20 16:06:01 +0100 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2025-03-20 16:06:01 +0100 |
commit | ea30adf487cad59824f6f2c7e97b900c4f2cb8a6 (patch) | |
tree | ee9e3275c1ff9f3de54d06139d9770b3738934b3 | |
parent | ee9ead484695089452d22eee7d37d80cd3aca5e5 (diff) | |
download | nextcloud-server-artonge/feat/allow_partial_seen_users.tar.gz nextcloud-server-artonge/feat/allow_partial_seen_users.zip |
feat: Catch callback exception in callForSeenUsersartonge/feat/allow_partial_seen_users
In case of large instances, `callForSeenUsers()` can take a lot of time to finish.
The new arguments give the opportunity for the caller to set a time limit, and to start from a given offset. The method now also returns the offset if it was stopped early.
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r-- | lib/private/User/Manager.php | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/private/User/Manager.php b/lib/private/User/Manager.php index a30d66868e4..6904093d045 100644 --- a/lib/private/User/Manager.php +++ b/lib/private/User/Manager.php @@ -637,9 +637,13 @@ class Manager extends PublicEmitter implements IUserManager { foreach ($this->backends as $backend) { if ($backend->userExists($userId)) { $user = $this->getUserObject($userId, $backend, false); - $return = $callback($user); - if ($return === false) { - return 0; + try { + $return = $callback($user); + if ($return === false) { + return 0; + } + } catch (\Throwable $e) { + $this->logger->error('Error while calling callback for seen users', ['exception' => $e, 'userId' => $userId, 'backend' => $backend::class]); } break; } |