Update commands now can fallback to API for point-tools user retrieval if it's not found in the database. Also small bug fixed.
This commit is contained in:
parent
2618398d06
commit
6c8c0829ca
|
@ -192,16 +192,19 @@ class UpdateSubscriptionsCommand extends Command
|
||||||
try {
|
try {
|
||||||
$serviceUser = $this->userRepo->findActiveUserWithSubscribers($this->appUserId);
|
$serviceUser = $this->userRepo->findActiveUserWithSubscribers($this->appUserId);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$this->logger->error('Error while getting active user with subscribers', ['app_user_id' => $appUserId]);
|
$this->logger->error('Error while getting active user with subscribers', ['app_user_id' => $this->appUserId]);
|
||||||
|
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$serviceUser) {
|
if (!$serviceUser) {
|
||||||
$this->logger->critical('Service user not found or marked as removed');
|
$this->logger->warning('Service user not found or marked as removed. Falling back to API.');
|
||||||
// @todo Retrieving user
|
|
||||||
|
|
||||||
throw new \RuntimeException('Service user not found in the database');
|
try {
|
||||||
|
$serviceUser = $this->api->getUserById($this->appUserId);
|
||||||
|
} catch (UserNotFoundException $e) {
|
||||||
|
throw new \RuntimeException('Service user not found in the database and could not be retrieved from API.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->info('Getting service subscribers');
|
$this->logger->info('Getting service subscribers');
|
||||||
|
|
|
@ -164,9 +164,13 @@ class UpdateUsersPrivacyCommand extends Command
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$serviceUser) {
|
if (!$serviceUser) {
|
||||||
$this->logger->critical('Service user not found or marked as removed');
|
$this->logger->warning('Service user not found or marked as removed. Falling back to API.');
|
||||||
|
|
||||||
throw new \RuntimeException('Service user not found in the database');
|
try {
|
||||||
|
$serviceUser = $this->api->getUserById($this->appUserId);
|
||||||
|
} catch (UserNotFoundException $e) {
|
||||||
|
throw new \RuntimeException('Service user not found in the database and could not be retrieved from API.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->logger->info('Getting service subscribers');
|
$this->logger->info('Getting service subscribers');
|
||||||
|
|
Loading…
Reference in a new issue