From 4a7ceda16e54a533b40109699c1673fb98bad2b6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Mon, 22 Jun 2020 15:43:44 +0200 Subject: [PATCH] Make use of NotificationEmailDeliveryBackgroundJob Fixes #2885 --- .../user/notification/UserNotificationHandler.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php index 4672efdfa0..7895753bfa 100644 --- a/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php +++ b/wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php @@ -9,6 +9,8 @@ use wcf\data\user\notification\UserNotificationAction; use wcf\data\user\User; use wcf\data\user\UserEditor; use wcf\data\user\UserProfile; +use wcf\system\background\job\NotificationEmailDeliveryBackgroundJob; +use wcf\system\background\BackgroundQueueHandler; use wcf\system\cache\builder\UserNotificationEventCacheBuilder; use wcf\system\cache\runtime\UserProfileRuntimeCache; use wcf\system\database\util\PreparedStatementConditionBuilder; @@ -726,7 +728,11 @@ class UserNotificationHandler extends SingletonFactory { ])); } - $email->send(); + $jobs = $email->getJobs(); + foreach ($jobs as $job) { + $wrappedJob = new NotificationEmailDeliveryBackgroundJob($job, $notification, $user); + BackgroundQueueHandler::getInstance()->enqueueIn($wrappedJob); + } } /** -- 2.20.1