jenkins-bot has submitted this change and it was merged.

Change subject: Move failed jobs to damaged message queue
......................................................................


Move failed jobs to damaged message queue

Try to decrease failmail spam.  "The definition of insanity..."
and all that.

Bug: T117447
Change-Id: I496381c5f48b6d4ed3dcdf2cf520e5c2609abbd5
---
M Maintenance/StompJobRunner.php
1 file changed, 9 insertions(+), 4 deletions(-)

Approvals:
  Awight: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Maintenance/StompJobRunner.php b/Maintenance/StompJobRunner.php
index 132aaa3..916d595 100644
--- a/Maintenance/StompJobRunner.php
+++ b/Maintenance/StompJobRunner.php
@@ -15,10 +15,12 @@
 class StompJobRunner extends MaintenanceBase {
 
        protected $datastore = null;
+       protected $damagedDatastore = null;
 
        public function __construct() {
                parent::__construct();
                $this->addOption( 'queue', 'queue name to consume from', 'jobs' 
);
+               $this->addOption( 'damaged-queue', 'name of queue to hold 
failed job messages', 'jobs-damaged' );
                $this->addOption( 'time-limit', 'Try to keep execution under 
<n> seconds', 60, 't' );
                $this->addOption( 'max-messages', 'At most consume <n> 
messages', 10, 'm' );
        }
@@ -28,6 +30,7 @@
         */
        public function execute() {
                $this->datastore = new StompDataStore( $this->getOption( 
'queue' ) );
+               $this->damagedDatastore = new StompDataStore( $this->getOption( 
'damaged-queue' ) );
 
                $startTime = time();
                $messageCount = 0;
@@ -46,13 +49,15 @@
                                        $successCount += 1;
                                        $this->datastore->queueAckObject();
                                } else {
-                                       Logger::info( "Job tells us that it did 
not successfully execute. Re-queueing for later.", $jobObj );
-                                       $this->datastore->queueIgnoreObject();
+                                       Logger::info( "Job tells us that it did 
not successfully execute. Sending to damaged message queue.", $jobObj );
+                                       
$this->damagedDatastore->queueAddObject( $jobObj );
+                                       $this->datastore->queueAckObject();
                                }
                        } else {
-                               $this->datastore->queueIgnoreObject();
+                               $this->damagedDatastore->queueAddObject( 
$jobObj );
+                               $this->datastore->queueAckObject();
                                Logger::warning(
-                                       get_class( $jobObj ) . " is not an 
instance of RunnableJob. Could not execute and re-queueing."
+                                       get_class( $jobObj ) . " is not an 
instance of RunnableJob. Could not execute and sending to damaged message 
queue."
                                );
                        }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/251314
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I496381c5f48b6d4ed3dcdf2cf520e5c2609abbd5
Gerrit-PatchSet: 4
Gerrit-Project: wikimedia/fundraising/SmashPig
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to