Skip to content

Commit a06a42a

Browse files
authored
fix: job dispatching on wiki creation (#1006)
MediawikiInit Job now needs a persisted wiki to access the right backend host, so this change moves the dispatching after that. https://phabricator.wikimedia.org/T410608 Bug: T410608
1 parent 4ef32ab commit a06a42a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

app/Http/Controllers/WikiController.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public function create(Request $request): \Illuminate\Http\Response {
7171
$dbAssignment = null;
7272

7373
// TODO create with some sort of owner etc?
74-
DB::transaction(function () use ($user, $request, &$wiki, &$dbAssignment, $isSubdomain, $submittedDomain, $rawProfile) {
74+
DB::transaction(function () use ($user, $request, &$wiki, &$dbAssignment, $submittedDomain, $rawProfile) {
7575
$dbVersion = Config::get('wbstack.wiki_db_use_version');
7676
$wikiDbCondition = ['wiki_id' => null, 'version' => $dbVersion];
7777

@@ -161,15 +161,15 @@ public function create(Request $request): \Illuminate\Http\Response {
161161
if ($rawProfile) {
162162
WikiProfile::create(['wiki_id' => $wiki->id, ...$rawProfile]);
163163
}
164-
165-
// TODO maybe always make these run in a certain order..?
166-
dispatch(new MediawikiInit($wiki->domain, $request->input('username'), $user->email));
167-
// Only dispatch a job to add a k8s ingress IF we are using a custom domain...
168-
if (!$isSubdomain) {
169-
dispatch(new KubernetesIngressCreate($wiki->id, $wiki->domain));
170-
}
171164
});
172165

166+
// TODO maybe always make these run in a certain order..?
167+
dispatch(new MediawikiInit($wiki->domain, $request->input('username'), $user->email));
168+
// Only dispatch a job to add a k8s ingress IF we are using a custom domain...
169+
if (!$isSubdomain) {
170+
dispatch(new KubernetesIngressCreate($wiki->id, $wiki->domain));
171+
}
172+
173173
// dispatch elasticsearch init job to enable the feature
174174
if (Config::get('wbstack.elasticsearch_enabled_by_default')) {
175175
if ($clusterWithoutSharedIndex) {

0 commit comments

Comments
 (0)