Skip to content

Commit 0982822

Browse files
authored
fix(mw-jobs): fix env var lookup, print error message (#711)
* fix(mw-jobs): fix env var lookup, print error message * docs: add changelog
1 parent e340b98 commit 0982822

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

CHANGELOG.md

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

3+
## 8x.31.1 - 18 December 2023
4+
- Fix namespace lookup for api-jobs
5+
36
## 8x.31.0 - 14 December 2023
47
- Dispatch jobs for rebuilding Queryservice data to non-default queue
58

app/Jobs/ProcessMediaWikiJobsJob.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ public function handle (Client $kubernetesClient): void
101101

102102
$job = $kubernetesClient->jobs()->apply($jobSpec);
103103
$jobName = data_get($job, 'metadata.name');
104-
if (!$jobName) {
104+
if (data_get($job, 'status') === 'Failure' || !$jobName) {
105105
// The k8s client does not fail reliably on 4xx responses, so checking the name
106106
// currently serves as poor man's error handling.
107107
$this->fail(
108-
new \RuntimeException('Job creation for wiki "'.$this->wikiDomain.'" failed.')
108+
new \RuntimeException('Job creation for wiki "'.$this->wikiDomain.'" failed with message: '.data_get($job, 'message', 'n/a'))
109109
);
110110
return;
111111
}

config/wbstack.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@
2929
'qs_batch_mark_failed_after' => intval(env('WBSTACK_QS_BATCH_MARK_FAILED_AFTER', '3')),
3030
'qs_batch_entity_limit' => intval(env('WBSTACK_QS_BATCH_ENTITY_LIMIT', '10')),
3131

32-
'api_job_namespace' => env('API_JOB_NAMESPACE') || env('WBSTACK_API_JOB_NAMESPACE', 'api-jobs'),
32+
'api_job_namespace' => env('API_JOB_NAMESPACE', env('WBSTACK_API_JOB_NAMESPACE', 'api-jobs')),
3333
'qs_job_namespace' => env('WBSTACK_QS_JOB_NAMESPACE', 'qs-jobs'),
3434
];

0 commit comments

Comments
 (0)