Bsitu has uploaded a new change for review.
https://gerrit.wikimedia.org/r/156594
Change subject: Specify which event type to use job queue
......................................................................
Specify which event type to use job queue
This will allow us to specify which notifications to use job queue
Change-Id: I7bf576acf332f5344b35188b5262df2319d15b79
---
M controller/NotificationController.php
M model/Event.php
2 files changed, 17 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Echo
refs/changes/94/156594/1
diff --git a/controller/NotificationController.php
b/controller/NotificationController.php
index a77b0f0..68b7393 100644
--- a/controller/NotificationController.php
+++ b/controller/NotificationController.php
@@ -47,7 +47,9 @@
* @param boolean $defer Defer to job queue or not
*/
public static function notify( $event, $defer = true ) {
- if ( $defer ) {
+ // Defer to job queue if defer to job queue is requested and
+ // this event should use job queue
+ if ( $defer && $event->getUseJobQueue() ) {
// defer job insertion till end of request when all
primary db transactions
// have been committed
DeferredUpdates::addCallableUpdate( function() use (
$event ) {
diff --git a/model/Event.php b/model/Event.php
index af67914..235c026 100644
--- a/model/Event.php
+++ b/model/Event.php
@@ -460,6 +460,20 @@
return $attributeManager->getNotificationSection( $this->type );
}
+ /**
+ * Get the use-jobqueue attribute of an event type
+ * @FIXME - use global for now instead of attribute manager, we may need
+ * to cherry pick this to enwiki
+ * @return boolean
+ */
+ public function getUseJobQueue() {
+ global $wgEchoNotifications;
+ if ( isset( $wgEchoNotifications[$this->type]['use-jobqueue'] )
) {
+ return
(bool)$wgEchoNotifications[$this->type]['use-jobqueue'];
+ }
+ return false;
+ }
+
public function setType( $type ) {
$this->type = $type;
}
--
To view, visit https://gerrit.wikimedia.org/r/156594
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I7bf576acf332f5344b35188b5262df2319d15b79
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Echo
Gerrit-Branch: master
Gerrit-Owner: Bsitu <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits