Skip to content

Commit

Permalink
Simplify the setting of the $domainthrottle array
Browse files Browse the repository at this point in the history
  • Loading branch information
bramley committed Jul 1, 2023
1 parent 940ae5c commit e920f00
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions public_html/lists/admin/actions/processqueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -1080,13 +1080,15 @@ function sendEmailTest($messageid, $email)
}
$now = time();
$interval = $now - ($now % DOMAIN_BATCH_PERIOD);
if (!isset($domainthrottle[$throttleDomain]) || !is_array($domainthrottle[$throttleDomain])) {
if (!isset($domainthrottle[$throttleDomain])
|| $domainthrottle[$throttleDomain]['interval'] < $interval) {
// new throttle domain or a new interval for existing domain
$domainthrottle[$throttleDomain] = array(
'interval' => '',
'interval' => $interval,
'sent' => 0,
'attempted' => 0,
);
} elseif (isset($domainthrottle[$throttleDomain]['interval']) && $domainthrottle[$throttleDomain]['interval'] == $interval) {
} else {
$throttled = $domainthrottle[$throttleDomain]['sent'] >= DOMAIN_BATCH_SIZE;
if ($throttled) {
++$counters['send blocked by domain throttle'];
Expand Down Expand Up @@ -1170,12 +1172,7 @@ function sendEmailTest($messageid, $email)
// tried to send email , process succes / failure
if ($success) {
if (USE_DOMAIN_THROTTLE) {
if ($domainthrottle[$throttleDomain]['interval'] != $interval) {
$domainthrottle[$throttleDomain]['interval'] = $interval;
$domainthrottle[$throttleDomain]['sent'] = 1;
} else {
++$domainthrottle[$throttleDomain]['sent'];
}
++$domainthrottle[$throttleDomain]['sent'];
}
++$counters['sent'];
++$counters['sent_users_for_message '.$messageid];
Expand Down

0 comments on commit e920f00

Please sign in to comment.