JobQueueRedis::doBatchPush(): report metrics even when failures occur
authorOri Livneh <ori@wikimedia.org>
Thu, 22 Oct 2015 06:44:26 +0000 (23:44 -0700)
committerOri Livneh <ori@wikimedia.org>
Thu, 22 Oct 2015 06:45:55 +0000 (23:45 -0700)
The way the method is currently written, no stats are reported at all when
failures occur.

Change-Id: I627e8f6ce3a59098bc8949da7ed22f5c924177fc

includes/jobqueue/JobQueueRedis.php

index 419ed0e..1e957c2 100644 (file)
@@ -218,15 +218,15 @@ class JobQueueRedis extends JobQueue {
                                        $failed += count( $itemBatch );
                                }
                        }
-                       if ( $failed > 0 ) {
-                               wfDebugLog( 'JobQueueRedis', "Could not insert {$failed} {$this->type} job(s)." );
-
-                               throw new RedisException( "Could not insert {$failed} {$this->type} job(s)." );
-                       }
                        JobQueue::incrStats( 'inserts', $this->type, count( $items ) );
                        JobQueue::incrStats( 'inserts_actual', $pushed );
                        JobQueue::incrStats( 'dupe_inserts', $this->type,
                                count( $items ) - $failed - $pushed );
+                       if ( $failed > 0 ) {
+                               $err = "Could not insert {$failed} {$this->type} job(s).";
+                               wfDebugLog( 'JobQueueRedis', $err );
+                               throw new RedisException( $err );
+                       }
                } catch ( RedisException $e ) {
                        $this->throwRedisException( $conn, $e );
                }