Skip to content

Commit

Permalink
Slice array sooner
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Mar 9, 2024
1 parent 62d234b commit 9fe315c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/services/SendoutsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,10 @@ private function _getPendingRecipientsSingular(SendoutElement $sendout, int $lim
}
}

if ($limit !== null) {
$contactIds = array_slice($contactIds, 0, $limit);
}

foreach ($contactIds as $contactId) {
$recipients[] = [
'contactId' => $contactId,
Expand All @@ -735,10 +739,6 @@ private function _getPendingRecipientsSingular(SendoutElement $sendout, int $lim
];
}

if ($limit !== null) {
$recipients = array_slice($recipients, 0, $limit);
}

return $recipients;
}

Expand Down

0 comments on commit 9fe315c

Please sign in to comment.