Skip to content

Commit

Permalink
Merge pull request #6592 from nextcloud/fix/outbox-job-send-message-d…
Browse files Browse the repository at this point in the history
…eleted-account

Fix sending outbox messages of deletd accounts
  • Loading branch information
kesselb authored May 31, 2022
2 parents 61e187e + 2cc7275 commit 977f67a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions lib/Service/OutboxService.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,25 @@ public function flush(): void {
}, $messages));

$accounts = array_combine($accountIds, array_map(function ($accountId) {
return $this->accountService->findById($accountId);
try {
return $this->accountService->findById($accountId);
} catch (DoesNotExistException $e) {
// The message belongs to a deleted account

return null;
}
}, $accountIds));

foreach ($messages as $message) {
try {
$account = $accounts[$message->getAccountId()];
if ($account === null) {
// Ignore message of non-existent account
continue;
}
$this->sendMessage(
$message,
$accounts[$message->getAccountId()],
$account,
);
$this->logger->debug('Outbox message {id} sent', [
'id' => $message->getId(),
Expand Down

0 comments on commit 977f67a

Please sign in to comment.