fix(files_reminders): keep batch alive on per-row failure

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
This commit is contained in:
Git'Fellow 2026-05-24 11:25:00 +02:00
parent 8609cd45ba
commit 1d8f788230

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]);
}
}
}