Added configuration for the bulk delivery

This commit is contained in:
Michael 2022-05-02 17:34:40 +00:00
parent 6e394ac6ff
commit 3163760343
2 changed files with 24 additions and 7 deletions

View File

@ -786,21 +786,34 @@ class Notifier
Logger::info('Delivery via ActivityPub', ['cmd' => $cmd, 'id' => $target_item['id'], 'inbox' => $inbox]);
if (DI::config()->get('system', 'bulk_delivery')) {
if (Worker::add(['priority' => $priority, 'created' => $created, 'dont_fork' => true],
'APDelivery', $cmd, 0, $inbox, $uid)) {
$delivery_queue_count++;
Post\Delivery::add($target_item['uri-id'], $uid, $inbox, $target_item['created'], $cmd);
}
} else {
if (Worker::add(['priority' => $priority, 'created' => $created, 'dont_fork' => true],
'APDelivery', $cmd, $target_item['id'], $inbox, $uid, $receivers, $target_item['uri-id'])) {
$delivery_queue_count++;
}
}
}
// We deliver posts to relay servers slightly delayed to priorize the direct delivery
foreach ($relay_inboxes as $inbox) {
Logger::info('Delivery to relay servers via ActivityPub', ['cmd' => $cmd, 'id' => $target_item['id'], 'inbox' => $inbox]);
if (DI::config()->get('system', 'bulk_delivery')) {
if (Worker::add(['priority' => $priority, 'dont_fork' => true], 'APDelivery', $cmd, 0, $inbox, $uid)) {
$delivery_queue_count++;
Post\Delivery::add($target_item['uri-id'], $uid, $inbox, $target_item['created'], $cmd);
}
} else {
if (Worker::add(['priority' => $priority, 'dont_fork' => true], 'APDelivery', $cmd, $target_item['id'], $inbox, $uid, [], $target_item['uri-id'])) {
$delivery_queue_count++;
}
}
}
return ['count' => $delivery_queue_count, 'contacts' => $contacts];

View File

@ -122,6 +122,10 @@ return [
// Display "Emoji Only" posts in big.
'big_emojis' => false,
// bulk_delivery (Boolean)
// Delivers AP messages in a bulk (experimental)
'bulk_delivery' => false,
// block_local_dir (Boolean)
// Deny public access to the local user directory.
'block_local_dir' => false,