1
0
Fork 0

Merge pull request #11917 from annando/cooldown

More cooldown calls for worker processes
This commit is contained in:
Hypolite Petovan 2022-09-22 22:39:04 -04:00 committed by GitHub
commit be9bbe1709
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 111 additions and 37 deletions

View file

@ -573,6 +573,7 @@ class Notifier
if (Worker::add($deliver_options, 'Delivery', $cmd, $post_uriid, (int)$contact['id'], $sender_uid)) {
$delivery_queue_count++;
}
Worker::coolDown();
}
return $delivery_queue_count;
}
@ -695,6 +696,7 @@ class Notifier
Logger::info('Account removal via ActivityPub', ['uid' => $self_user_id, 'inbox' => $inbox]);
Worker::add(['priority' => PRIORITY_NEGLIGIBLE, 'created' => $created, 'dont_fork' => true],
'APDelivery', Delivery::REMOVAL, 0, $inbox, $self_user_id, $receivers);
Worker::coolDown();
}
return true;
@ -818,6 +820,7 @@ class Notifier
$delivery_queue_count++;
}
}
Worker::coolDown();
}
// We deliver posts to relay servers slightly delayed to priorize the direct delivery
@ -833,6 +836,7 @@ class Notifier
$delivery_queue_count++;
}
}
Worker::coolDown();
}
return ['count' => $delivery_queue_count, 'contacts' => $contacts];

View file

@ -81,6 +81,7 @@ class PollContacts
Logger::notice("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact['priority'] . " " . $contact["nick"] . " " . $contact["name"]);
Worker::add(['priority' => $priority, 'dont_fork' => true, 'force_priority' => true], 'OnePoll', (int)$contact['id']);
Worker::coolDown();
}
DBA::close($contacts);
}

View file

@ -62,6 +62,7 @@ class UpdateContacts
if (Worker::add(['priority' => PRIORITY_LOW, 'dont_fork' => true], "UpdateContact", $contact['id'])) {
++$count;
}
Worker::coolDown();
}
DBA::close($contacts);

View file

@ -72,6 +72,7 @@ class UpdateGServers
$count++;
}
}
Worker::coolDown();
}
DBA::close($gservers);
Logger::info('Updated servers', ['count' => $count]);

View file

@ -63,6 +63,7 @@ class UpdateServerPeers
// This endpoint doesn't offer the schema. So we assume that it is HTTPS.
GServer::add('https://' . $peer);
++$added;
Worker::coolDown();
}
Logger::info('Server peer update ended', ['total' => $total, 'added' => $added, 'url' => $url]);
}