Permalink
Browse files

Fixed rate limit sleep issues.

  • Loading branch information...
cubiclesoft committed Sep 6, 2018
1 parent 4c4eda8 commit 342b17b6f1473b235d51e3c986673f28c6b619b6
Showing with 2 additions and 1 deletion.
  1. +2 −1 support/smtp.php
View
@@ -803,9 +803,10 @@ private static function ProcessRateLimit($size, $start, $limit, $async)
// Sleeping for some amount of time will equalize the rate.
// So, solve this for $x: $size / ($x + $difftime) = $limit
$amount = ($size - ($limit * $difftime)) / $limit;
$amount += 0.001;
if ($async) return microtime(true) + $amount;
else usleep($amount);
else usleep($amount * 1000000);
}
}

0 comments on commit 342b17b

Please sign in to comment.