Aaron Schulz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/145456

Change subject: Added more error message calls
......................................................................

Added more error message calls

Change-Id: I21b440d934364788e1055d2892cbef048d2e9f16
---
M redisJobRunnerService
1 file changed, 12 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/jobrunner 
refs/changes/56/145456/1

diff --git a/redisJobRunnerService b/redisJobRunnerService
index a7f5ed8..dace5c1 100755
--- a/redisJobRunnerService
+++ b/redisJobRunnerService
@@ -728,9 +728,14 @@
                                        }
                                        $res = $this->redisCmd( $qConn, 'exec' 
);
 
+                                       $failed = 0;
                                        $now = time();
                                        $mapSet = array(); // map of (queue 
name => timestamp)
                                        foreach ( $res as $i => $result ) {
+                                               if ( !$result ) {
+                                                       ++$failed;
+                                                       continue;
+                                               }
                                                $tasksRun += array_sum( $result 
);
                                                list( $released, $abandoned, 
$pruned, $undelayed ) = $result;
                                                if ( $released > 0 || 
$undelayed > 0 ) {
@@ -745,10 +750,15 @@
                                        unset( $this->conns[$qServer] );
                                }
 
+                               if ( $failed > 0 ) {
+                                       $this->error( "Failed to do periodic 
tasks for $failed queue(s)." );
+                               }
+
                                $this->redisCmd( $aConn, 'hMSet', array( 
$this->getReadyQueueKey(), $mapSet ) );
                        }
                } catch ( RedisException $e ) {
                        unset( $this->conns[$aServer] );
+                       $this->error( "Failed to do periodic tasks for all 
queue(s)." );
                }
 
                return $tasksRun;
@@ -822,6 +832,7 @@
                        list( $host, $port ) = explode( ':', $server ); // IPv4
                        $result = $conn->connect( $host, $port, 5 );
                        if ( !$result ) {
+                               $this->error( "Could not connect to Redis 
server $host:$port." );
                                // Mark server down for some time to avoid 
further timeouts
                                $this->downSrvs[$server] = time() + 30;
 
@@ -857,6 +868,7 @@
                $conn->clearLastError();
                $res = call_user_func_array( array( $conn, $cmd ), $args );
                if ( $conn->getLastError() ) {
+                       $this->error( "Redis error: " . $conn->getLastError() );
                        // Make all errors be exceptions instead of "most but 
not all".
                        // This will let the caller know to reset the 
connection to be safe.
                        throw new RedisException( $conn->getLastError() );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I21b440d934364788e1055d2892cbef048d2e9f16
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/jobrunner
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <asch...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to