File tree Expand file tree Collapse file tree
apps/files_reminders/lib/BackgroundJob Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111
1212use OCA \FilesReminders \Db \ReminderMapper ;
1313use OCA \FilesReminders \Service \ReminderService ;
14- use OCP \AppFramework \Db \DoesNotExistException ;
1514use OCP \AppFramework \Utility \ITimeFactory ;
1615use OCP \BackgroundJob \TimedJob ;
1716use Psr \Log \LoggerInterface ;
17+ use Throwable ;
1818
1919class 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 }
You can’t perform that action at this time.
0 commit comments