Skip to content

Commit 7952fae

Browse files
authored
chore(mw-jobs): run polling job less often (#611)
* chore(mw-jobs): run polling job less often * chore(mw-jobs): temporarily return early from job
1 parent d8403f9 commit 7952fae

4 files changed

Lines changed: 16 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# api
22

3+
## 8x.12.3 - 19 June 2023
4+
- Temporary fix: make polling job a no-op so the queue can empty
5+
- Run polling job less often
6+
37
## 8x.12.2 - 13 June 2023
48
- Make sure job for polling wikis does queue properly
59

app/Console/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ protected function schedule(Schedule $schedule)
4545
// Schedule site stat updates for each wiki and platform-summary
4646
$schedule->command('schedule:stats')->daily();
4747

48-
$schedule->job(new PollForMediaWikiJobsJob)->everyMinute();
48+
$schedule->job(new PollForMediaWikiJobsJob)->everyFifteenMinutes();
4949
}
5050

5151
/**

app/Jobs/PollForMediaWikiJobsJob.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,15 @@ class PollForMediaWikiJobsJob extends Job implements ShouldQueue, ShouldBeUnique
1313
public $timeout = 3600;
1414
public function handle (): void
1515
{
16-
$allWikiDomains = Wiki::all()->pluck('domain');
17-
foreach ($allWikiDomains as $wikiDomain) {
18-
if ($this->hasPendingJobs($wikiDomain)) {
19-
$this->enqueueWiki($wikiDomain);
16+
return;
17+
/*
18+
$allWikiDomains = Wiki::all()->pluck('domain');
19+
foreach ($allWikiDomains as $wikiDomain) {
20+
if ($this->hasPendingJobs($wikiDomain)) {
21+
$this->enqueueWiki($wikiDomain);
22+
}
2023
}
21-
}
24+
*/
2225
}
2326

2427
private function hasPendingJobs (string $wikiDomain): bool

tests/Jobs/PollForMediaWikiJobsJobTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public function setUp(): void
2727

2828
public function testNoJobs()
2929
{
30+
$this->markTestSkipped();
3031
Http::fake([
3132
getenv('PLATFORM_MW_BACKEND_HOST').'/w/api.php?action=query&meta=siteinfo&siprop=statistics&format=json' => Http::response([
3233
'query' => [
@@ -50,6 +51,7 @@ public function testNoJobs()
5051

5152
public function testWithJobs()
5253
{
54+
$this->markTestSkipped();
5355
Http::fake([
5456
getenv('PLATFORM_MW_BACKEND_HOST').'/w/api.php?action=query&meta=siteinfo&siprop=statistics&format=json' => Http::response([
5557
'query' => [
@@ -74,6 +76,7 @@ public function testWithJobs()
7476

7577
public function testWithFailure()
7678
{
79+
$this->markTestSkipped();
7780
Http::fake([
7881
getenv('PLATFORM_MW_BACKEND_HOST').'/w/api.php?action=query&meta=siteinfo&siprop=statistics&format=json' => Http::response([
7982
'error' => 'Something went wrong'

0 commit comments

Comments
 (0)