From 5d7a4605bd0bd71949a37139eccfbf8a70d0c32e Mon Sep 17 00:00:00 2001 From: winter Date: Sun, 11 May 2025 18:24:02 +0100 Subject: improvements to simple remote actor support --- Digitigrade/Job/PeriodicFetchRemoteFeed.php | 14 +++++++++----- Digitigrade/Model/Actor.php | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) (limited to 'Digitigrade') diff --git a/Digitigrade/Job/PeriodicFetchRemoteFeed.php b/Digitigrade/Job/PeriodicFetchRemoteFeed.php index e84757f..c64446d 100644 --- a/Digitigrade/Job/PeriodicFetchRemoteFeed.php +++ b/Digitigrade/Job/PeriodicFetchRemoteFeed.php @@ -28,10 +28,14 @@ class PeriodicFetchRemoteFeed extends Job { } } - public function submit() { - JobQueue::getInstance()->submitDelayedUntil( - $this, - (new \DateTimeImmutable)->add(new \DateInterval(GlobalSettings::getInstance()->get('instance.feedUpdateInterval') ?? 'PT1H')) - ); + public function submit(bool $now = false) { + if ($now) { + JobQueue::getInstance()->submitUrgent($this); + } else { + JobQueue::getInstance()->submitDelayedUntil( + $this, + (new \DateTimeImmutable)->add(new \DateInterval(GlobalSettings::getInstance()->get('instance.feedUpdateInterval') ?? 'PT1H')) + ); + } } } \ No newline at end of file diff --git a/Digitigrade/Model/Actor.php b/Digitigrade/Model/Actor.php index 3fb7e4e..a8909df 100644 --- a/Digitigrade/Model/Actor.php +++ b/Digitigrade/Model/Actor.php @@ -259,7 +259,7 @@ class Actor extends PushableModel implements RpcReceiver { if (!$target->isLocal && !isset($target->endpoints->follow, $target->endpoints->unfollow)) { // if this is the first time someone local followed this actor, put a job in to update them if (count(array_filter($target->findFollowers(), fn(Actor $a) => $a->isLocal)) == 0) { - (new PeriodicFetchRemoteFeed($target))->submit(); + (new PeriodicFetchRemoteFeed($target))->submit(now: true); } FollowRelation::create($this, $target, FollowRelationStatus::ACTIVE); // no need to processNotifications because it's always going to be a remote user & not pending -- cgit v1.3