JobQueueGroup: Allow readOnlyReason to be specified per JQ type
authorMarko Obrovac <mobrovac@wikimedia.org>
Thu, 19 Jul 2018 16:13:38 +0000 (18:13 +0200)
committerMarko Obrovac <mobrovac@wikimedia.org>
Thu, 19 Jul 2018 16:13:38 +0000 (18:13 +0200)
We use $wgReadOnly for various reasons, one of which is to disallow
writes in the currently-non-active DC. However, we should allow the
readOnlyReason configuration variable to be available per JobQueue type
and have it the code respect that.

In our current set-up, we use JobQueueEventBus which ever only uses the
enqueue execution path and does not depend upon which DC it is executed
in, so this will allow us to enqueue jobs in both DCs.

Note that this is an alternative approach to the one outlined in
Ibbad6063b6b154d7f7d172c79f7be324bf80eb7e

Bug: T199594
Change-Id: I8f1a57a81ea11c1c587c0057fa8bb3454b0e0b56

includes/jobqueue/JobQueueGroup.php

index 37c8890..820c492 100644 (file)
@@ -111,7 +111,7 @@ class JobQueueGroup {
                        $conf = $conf + $wgJobTypeConf['default'];
                }
                $conf['aggregator'] = JobQueueAggregator::singleton();
-               if ( $this->readOnlyReason !== false ) {
+               if ( !isset( $conf['readOnlyReason'] ) ) {
                        $conf['readOnlyReason'] = $this->readOnlyReason;
                }