55use Illuminate \Console \Command ;
66use Illuminate \Support \Facades \Http ;
77use Illuminate \Support \Facades \Log ;
8+ use Illuminate \Support \Facades \Queue ;
89use App \Wiki ;
910use App \WikiSetting ;
1011use App \QueryserviceNamespace ;
@@ -16,18 +17,20 @@ class RebuildQueryserviceData extends Command
1617 private const NAMESPACE_PROPERTY = 122 ;
1718 private const NAMESPACE_LEXEME = 146 ;
1819
19- protected $ signature = 'wbs-qs:rebuild {--domain=*} {--chunkSize=50} {--sparqlUrlFormat=http://queryservice.default.svc.cluster.local:9999/bigdata/namespace/%s/sparql} ' ;
20+ protected $ signature = 'wbs-qs:rebuild {--domain=*} {--chunkSize=50} {--queueName=manual-intervention} {-- sparqlUrlFormat=http://queryservice.default.svc.cluster.local:9999/bigdata/namespace/%s/sparql} ' ;
2021
2122 protected $ description = 'Rebuild the queryservice data for a certain wiki or all wikis ' ;
2223
2324 protected int $ chunkSize ;
2425 protected string $ apiUrl ;
2526 protected string $ sparqlUrlFormat ;
27+ protected string $ queueName ;
2628
2729 public function handle ()
2830 {
2931 $ this ->chunkSize = intval ($ this ->option ('chunkSize ' ));
3032 $ this ->sparqlUrlFormat = $ this ->option ('sparqlUrlFormat ' );
33+ $ this ->queueName = $ this ->option ('queueName ' );
3134 $ this ->apiUrl = getenv ('PLATFORM_MW_BACKEND_HOST ' ).'/w/api.php ' ;
3235
3336 $ wikiDomains = $ this ->option ('domain ' );
@@ -56,13 +59,11 @@ public function handle()
5659
5760 $ entityChunks = array_chunk ($ entities , $ this ->chunkSize );
5861 foreach ($ entityChunks as $ entityChunk ) {
59- dispatch (
60- new SpawnQueryserviceUpdaterJob (
61- $ wiki ->domain ,
62- implode (', ' , $ entityChunk ),
63- $ sparqlUrl ,
64- )
65- );
62+ Queue::pushOn ($ this ->queueName , new SpawnQueryserviceUpdaterJob (
63+ $ wiki ->domain ,
64+ implode (', ' , $ entityChunk ),
65+ $ sparqlUrl ,
66+ ));
6667 }
6768 $ jobTotal += count ($ entityChunks );
6869 $ processedWikis += 1 ;
0 commit comments