]> git.mxchange.org Git - friendica.git/blobdiff - src/Worker/Notifier.php
Issue 11932: Restore SQL performance
[friendica.git] / src / Worker / Notifier.php
index d06dfead615d9cf6a5e7978da77acf0fb23a2475..3b4e1478c015527d45eac0aef9bdecf05094bfc0 100644 (file)
@@ -502,6 +502,11 @@ class Notifier
                $a = DI::app();
                $delivery_queue_count = 0;
 
+               if (!empty($target_item['verb']) && ($target_item['verb'] == Activity::ANNOUNCE)) {
+                       Logger::notice('Announces are only delivery via ActivityPub', ['cmd' => $cmd, 'id' => $target_item['id'], 'guid' => $target_item['guid'], 'uri-id' => $target_item['uri-id'], 'uri' => $target_item['uri']]);
+                       return 0;
+               }
+
                foreach ($contacts as $contact) {
                        // Direct delivery of local contacts
                        if (!in_array($cmd, [Delivery::RELOCATION, Delivery::SUGGESTION, Delivery::DELETION, Delivery::MAIL]) && $target_uid = User::getIdForURL($contact['url'])) {
@@ -568,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;
        }
@@ -690,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;
@@ -813,6 +820,7 @@ class Notifier
                                        $delivery_queue_count++;
                                }
                        }
+                       Worker::coolDown();
                }
 
                // We deliver posts to relay servers slightly delayed to priorize the direct delivery
@@ -828,6 +836,7 @@ class Notifier
                                        $delivery_queue_count++;
                                }
                        }
+                       Worker::coolDown();
                }
 
                return ['count' => $delivery_queue_count, 'contacts' => $contacts];