Skip to content

Commit

Permalink
Merge pull request #91 from Gizra/88-remove-range
Browse files Browse the repository at this point in the history
#88 - Remove unused/risky range early exit.
  • Loading branch information
jhedstrom authored May 26, 2017
2 parents b6abd97 + bf10149 commit fad079d
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
10 changes: 0 additions & 10 deletions message_subscribe.module
Original file line number Diff line number Diff line change
Expand Up @@ -73,23 +73,13 @@ function message_subscribe_message_subscribe_get_subscribers(MessageInterface $m
$result = $query->execute();

foreach ($result as $row) {

$debug && \Drupal::logger('message_subscribe')->debug(
'Subscriber row flag_id: @flag_id user: @uid',
['@flag_id' => $row->flag_id, '@uid' => $row->uid]
);
$uids[$row->uid] = !empty($uids[$row->uid]) ? $uids[$row->uid] : new DeliveryCandidate([], [], $row->uid);
// Register the flag name.
$uids[$row->uid]->addFlag($row->flag_id);

if ($range) {
--$range;
if ($range == 0) {
// We've reach the requested item.
\Drupal::logger('message_subscribe')->debug('Exiting hook early as range was reached. Last uid to process @uid', ['@uid' => $row->uid]);
return $uids;
}
}
}
}
$debug && \Drupal::logger('message_subscribe')->debug(
Expand Down
4 changes: 0 additions & 4 deletions src/Subscribers.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,6 @@ public function sendMessage(EntityInterface $entity, MessageInterface $message,
$message->save();
}

if ($use_queue) {
$id = $entity->id();
}

if ($use_queue && empty($subscribe_options['queue'])) {
if (empty($message->id())) {
throw new MessageSubscribeException('Cannot add a non-saved message to the queue.');
Expand Down

0 comments on commit fad079d

Please sign in to comment.