From 073695b33c5f9c5d89d91958b09259c59e12dd98 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 23 Jul 2022 23:10:47 +0000 Subject: [PATCH] Funkwhale context file moved --- src/Protocol/ActivityPub/Processor.php | 2 +- src/Protocol/ActivityPub/Queue.php | 6 ++++-- src/Worker/FetchMissingActivity.php | 1 + funkwhale.audio.jsonld => static/funkwhale.audio.jsonld | 0 4 files changed, 6 insertions(+), 3 deletions(-) rename funkwhale.audio.jsonld => static/funkwhale.audio.jsonld (100%) diff --git a/src/Protocol/ActivityPub/Processor.php b/src/Protocol/ActivityPub/Processor.php index 1a7458c0e..aa169ab02 100644 --- a/src/Protocol/ActivityPub/Processor.php +++ b/src/Protocol/ActivityPub/Processor.php @@ -935,7 +935,7 @@ class Processor Logger::info('Item insertion successful', ['user' => $item['uid'], 'item_id' => $item_id]); $success = true; } else { - Logger::notice('Item insertion aborted', ['user' => $item['uid']]); + Logger::notice('Item insertion aborted', ['uri' => $item['uri'], 'uid' => $item['uid']]); } if ($item['uid'] == 0) { diff --git a/src/Protocol/ActivityPub/Queue.php b/src/Protocol/ActivityPub/Queue.php index 6d0bed3e1..d150f9f9c 100644 --- a/src/Protocol/ActivityPub/Queue.php +++ b/src/Protocol/ActivityPub/Queue.php @@ -179,7 +179,9 @@ class Queue */ public static function clear() { - DBA::delete('inbox-entry', ["`wid` IS NULL AND `received` < ?", DateTimeFormat::utc('now - 4 hours')]); + // We delete all entries that aren't associated with a worker entry after seven days. + // The other entries are deleted when the worker deferred for too long. + DBA::delete('inbox-entry', ["`wid` IS NULL AND `received` < ?", DateTimeFormat::utc('now - 7 days')]); } /** @@ -190,7 +192,7 @@ class Queue */ public static function processReplyByUri(string $uri) { - $entries = DBA::select('inbox-entry', ['id'], ['in-reply-to-id' => $uri], ['order' => ['id' => true]]); + $entries = DBA::select('inbox-entry', ['id'], ["`in-reply-to-id` = ? AND `object-id` != ?", $uri, $uri]); while ($entry = DBA::fetch($entries)) { self::process($entry['id']); } diff --git a/src/Worker/FetchMissingActivity.php b/src/Worker/FetchMissingActivity.php index 1a2818c3c..6cb832c77 100644 --- a/src/Worker/FetchMissingActivity.php +++ b/src/Worker/FetchMissingActivity.php @@ -42,6 +42,7 @@ class FetchMissingActivity Queue::processReplyByUri($url); } elseif (!Worker::defer()) { Logger::info('Activity could not be fetched', ['url' => $url]); + // @todo performe recursive deletion of all entries } else { Logger::info('Fetching deferred', ['url' => $url]); } diff --git a/funkwhale.audio.jsonld b/static/funkwhale.audio.jsonld similarity index 100% rename from funkwhale.audio.jsonld rename to static/funkwhale.audio.jsonld