From 371f20a1aa0fdd662f6b80ec6d7b25f678e2c6f1 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 31 Jul 2022 07:48:35 +0000 Subject: [PATCH 1/2] Decoupling is deactivated by default now --- src/Worker/Cron.php | 4 +++- static/defaults.config.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 12ea6e60a3..2c724366da 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -93,7 +93,9 @@ class Cron Queue::clear(); // Process all unprocessed entries - Queue::processAll(); + if (DI::config()->get('system', 'decoupled_receiver')) { + Queue::processAll(); + } // Search for new contacts in the directory if (DI::config()->get('system', 'synchronize_directory')) { diff --git a/static/defaults.config.php b/static/defaults.config.php index a8a23ea9e9..01cd24f04b 100644 --- a/static/defaults.config.php +++ b/static/defaults.config.php @@ -166,7 +166,7 @@ return [ // decoupled_receiver (Boolean) // Decouple incoming AP posts by doing the processing in the background. - 'decoupled_receiver' => true, + 'decoupled_receiver' => false, // distributed_cache_driver (database|memcache|memcached|redis) // Whether to use database, Memcache, Memcached or Redis as a distributed cache. From 06a124338a0fb8e86bd835bc9fbae340652a7352 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 31 Jul 2022 08:10:47 +0000 Subject: [PATCH 2/2] Only store the inbox-queue on activated background processing --- src/Protocol/ActivityPub/Processor.php | 7 +++++-- src/Protocol/ActivityPub/Receiver.php | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index e3e2e295af..96308ca2cf 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -311,7 +311,9 @@ class Processor $result = self::fetchMissingActivity($activity['reply-to-id'], $activity, '', Receiver::COMPLETION_AUTO); if (empty($result) && self::isActivityGone($activity['reply-to-id'])) { // Recursively delete this and all depending entries - Queue::deleteById($activity['entry-id']); + if (!empty($activity['entry-id'])) { + Queue::deleteById($activity['entry-id']); + } return []; } $fetch_by_worker = empty($result); @@ -366,9 +368,10 @@ class Processor if (!empty($activity['raw'])) { $item['source'] = $activity['raw']; - $item['protocol'] = Conversation::PARCEL_ACTIVITYPUB; } + $item['protocol'] = Conversation::PARCEL_ACTIVITYPUB; + if (isset($activity['push'])) { $item['direction'] = $activity['push'] ? Conversation::PUSH : Conversation::PULL; } diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index 2231d0acbd..1d337f28af 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -583,7 +583,7 @@ class Receiver $object_data['object_activity'] = $activity; } - if ($trust_source || DI::config()->get('debug', 'ap_inbox_store_untrusted')) { + if (DI::config()->get('system', 'decoupled_receiver') && ($trust_source || DI::config()->get('debug', 'ap_inbox_store_untrusted'))) { $object_data = Queue::add($object_data, $type, $uid, $http_signer, $push, $trust_source); }