mirror of
https://github.com/nextcloud/server.git
synced 2026-06-12 18:21:40 -04:00
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:
commit
035801fede
1 changed files with 6 additions and 3 deletions
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue