diff --git a/lib/MailQueueHandler.php b/lib/MailQueueHandler.php index ee68dba79..3b557937a 100644 --- a/lib/MailQueueHandler.php +++ b/lib/MailQueueHandler.php @@ -136,7 +136,10 @@ public function sendEmails(int $limit, int $sendTime, bool $forceSending = false // Delete all entries we dealt with $this->deleteSentItems($deleteItemsForUsers, $sendTime); - return count($affectedUsers); + // Only count the users that were actually dealt with, so a batch of + // users whose lookup failed does not keep the CLI loops of the + // callers spinning on the same batch forever. + return count($deleteItemsForUsers); } /**