Skip to content

Commit 035801f

Browse files
authored
Merge pull request #60713 from nextcloud/fix/F3-scheduled-notifications-throwable
fix(files_reminders): keep batch alive on per-row failure
2 parents 20bc4e7 + 1d8f788 commit 035801f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

apps/files_reminders/lib/BackgroundJob/ScheduledNotifications.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@
1111

1212
use OCA\FilesReminders\Db\ReminderMapper;
1313
use OCA\FilesReminders\Service\ReminderService;
14-
use OCP\AppFramework\Db\DoesNotExistException;
1514
use OCP\AppFramework\Utility\ITimeFactory;
1615
use OCP\BackgroundJob\TimedJob;
1716
use Psr\Log\LoggerInterface;
17+
use Throwable;
1818

1919
class ScheduledNotifications extends TimedJob {
2020
public function __construct(
@@ -37,8 +37,11 @@ public function run($argument) {
3737
foreach ($reminders as $reminder) {
3838
try {
3939
$this->reminderService->send($reminder);
40-
} catch (DoesNotExistException $e) {
41-
$this->logger->debug('Could not send notification for reminder with id ' . $reminder->getId());
40+
} catch (Throwable $e) {
41+
// A single broken reminder (e.g. orphaned user record) must not
42+
// stall the rest of the queue, which is ordered by due_date ASC
43+
// and would otherwise re-hit the same row on every cron tick.
44+
$this->logger->error('Could not send notification for reminder with id ' . $reminder->getId(), ['exception' => $e]);
4245
}
4346
}
4447
}

0 commit comments

Comments
 (0)