Aaron Schulz has uploaded a new change for review.

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

Change subject: Improved Redis error logging
......................................................................

Improved Redis error logging

Change-Id: I48f5c9c9e70c903f62130f90c19ec76054b6fb4f
---
M redisJobRunnerService
1 file changed, 13 insertions(+), 5 deletions(-)


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

diff --git a/redisJobRunnerService b/redisJobRunnerService
index 2ec0812..be06703 100755
--- a/redisJobRunnerService
+++ b/redisJobRunnerService
@@ -610,7 +610,7 @@
                                                $this->redisCmd( $conn, 'sAdd', 
$params );
                                        }
                                } catch ( RedisException $e ) {
-                                       unset( $this->conns[$server] );
+                                       $this->handleRedisError( $e, $server );
                                }
                        }
                }
@@ -776,14 +776,14 @@
                                        }
                                } catch ( RedisException $e ) {
                                        $ok = false;
-                                       unset( $this->conns[$qServer] );
+                                       $this->handleRedisError( $e, $qServer );
                                }
 
                                $this->redisCmd( $aConn, 'hMSet', array( 
$this->getReadyQueueKey(), $mapSet ) );
                        }
                } catch ( RedisException $e ) {
                        $ok = false;
-                       unset( $this->conns[$aServer] );
+                       $this->handleRedisError( $e, $aServer );
                }
 
                if ( !$ok ) {
@@ -894,6 +894,16 @@
        }
 
        /**
+        * @param RedisException $e
+        * @param string $server
+        */
+       protected function handleRedisError( RedisException $e, $server ) {
+               unset( $this->conns[$server] );
+               $this->error( "Redis error: " . $e->getMessage() );
+               $this->incrStats( "redis-error." . gethostname(), 1 );
+       }
+
+       /**
         * @param Redis $conn
         * @param string $cmd
         * @param array $args
@@ -903,8 +913,6 @@
                $conn->clearLastError();
                $res = call_user_func_array( array( $conn, $cmd ), $args );
                if ( $conn->getLastError() ) {
-                       $this->error( "Redis error: " . $conn->getLastError() );
-                       $this->incrStats( "redis-error." . gethostname(), 1 );
                        // 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/148452
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I48f5c9c9e70c903f62130f90c19ec76054b6fb4f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/services/jobrunner
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>

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

Reply via email to