From 3500284bec7cfcaa55799c9dfd205377b6b49e27 Mon Sep 17 00:00:00 2001 From: CosmicAlpha Date: Mon, 18 Nov 2024 15:01:06 -0700 Subject: [PATCH] Use JobSpecification --- includes/HookHandlers/Main.php | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/includes/HookHandlers/Main.php b/includes/HookHandlers/Main.php index af1fe61..5ef92ae 100644 --- a/includes/HookHandlers/Main.php +++ b/includes/HookHandlers/Main.php @@ -2,6 +2,7 @@ namespace Miraheze\RottenLinks\HookHandlers; +use JobSpecification; use MediaWiki\Deferred\LinksUpdate\LinksUpdate; use MediaWiki\Hook\LinksUpdateCompleteHook; use MediaWiki\Hook\ParserFirstCallInitHook; @@ -11,7 +12,10 @@ use Miraheze\RottenLinks\RottenLinksParserFunctions; use Wikimedia\Rdbms\IConnectionProvider; -class Main implements LinksUpdateCompleteHook, ParserFirstCallInitHook { +class Main implements + LinksUpdateCompleteHook, + ParserFirstCallInitHook +{ private JobQueueGroupFactory $jobQueueGroupFactory; private RottenLinksParserFunctions $parserFunctions; @@ -35,13 +39,16 @@ public function onLinksUpdateComplete( $linksUpdate, $ticket ) { $removedExternalLinks = $linksUpdate->getRemovedExternalLinks(); if ( $addedExternalLinks || $removedExternalLinks ) { - $params = [ - 'addedExternalLinks' => $addedExternalLinks ?? [], - 'removedExternalLinks' => $removedExternalLinks ?? [], - ]; - $jobQueueGroup = $this->jobQueueGroupFactory->makeJobQueueGroup(); - $jobQueueGroup->push( new RottenLinksJob( $params ) ); + $jobQueueGroup->push( + new JobSpecification( + RottenLinksJob::JOB_NAME, + [ + 'addedExternalLinks' => $addedExternalLinks ?? [], + 'removedExternalLinks' => $removedExternalLinks ?? [], + ] + ) + ); } }