Skip to content

Commit

Permalink
Fix queue subscribers adding performance
Browse files Browse the repository at this point in the history
  • Loading branch information
mcjwsk committed Apr 11, 2016
1 parent 4e1a1bc commit 01d907a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/code/Magento/Newsletter/Model/ResourceModel/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ public function addSubscribersToQueue(ModelQueue $queue, array $subscriberIds)
$subscriberIds
);

$usedIds = $connection->fetchCol($select);
$usedIds = array_flip($connection->fetchCol($select));
$subscriberIds = array_flip($subscriberIds);
$newIds = array_diff_key($subscriberIds, $usedIds);

$connection->beginTransaction();
try {
foreach ($subscriberIds as $subscriberId) {
if (in_array($subscriberId, $usedIds)) {
continue;
}
foreach ($newIds as $subscriberId) {
$data = [];
$data['queue_id'] = $queue->getId();
$data['subscriber_id'] = $subscriberId;
Expand Down

0 comments on commit 01d907a

Please sign in to comment.