Merge pull request #60713 from nextcloud/fix/F3-scheduled-notifications-throwable

fix(files_reminders): keep batch alive on per-row failure
This commit is contained in:
Louis 2026-06-11 11:06:15 +02:00 committed by GitHub
commit 035801fede
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,10 +11,10 @@ namespace OCA\FilesReminders\BackgroundJob;
use OCA\FilesReminders\Db\ReminderMapper;
use OCA\FilesReminders\Service\ReminderService;
use OCP\AppFramework\Db\DoesNotExistException;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\TimedJob;
use Psr\Log\LoggerInterface;
use Throwable;
class ScheduledNotifications extends TimedJob {
public function __construct(
@ -37,8 +37,11 @@ class ScheduledNotifications extends TimedJob {
foreach ($reminders as $reminder) {
try {
$this->reminderService->send($reminder);
} catch (DoesNotExistException $e) {
$this->logger->debug('Could not send notification for reminder with id ' . $reminder->getId());
} catch (Throwable $e) {
// A single broken reminder (e.g. orphaned user record) must not
// stall the rest of the queue, which is ordered by due_date ASC
// and would otherwise re-hit the same row on every cron tick.
$this->logger->error('Could not send notification for reminder with id ' . $reminder->getId(), ['exception' => $e]);
}
}
}