Reduce the amount of "UpdateContact" worker calls

This commit is contained in:
Michael 2022-12-28 14:56:12 +00:00
parent 4bb0fdc9a9
commit e0e2e45b91
6 changed files with 89 additions and 18 deletions

View file

@ -205,9 +205,15 @@ class Delivery
*/
private static function setSuccess(array $receivers, bool $success)
{
$gsid = null;
$gsid = null;
$update_counter = 0;
foreach ($receivers as $receiver) {
// Only update the first 10 receivers to avoid flooding the remote system with requests
if ($success && ($update_counter < 10) && Contact::updateByIdIfNeeded($receiver)) {
$update_counter++;
}
$contact = Contact::getById($receiver);
if (empty($contact)) {
continue;