lib/mongo/retryable.rb in mongo-2.2.0 vs lib/mongo/retryable.rb in mongo-2.2.1

- old
+ new

@@ -22,10 +22,15 @@ # The not master error message. # # @since 2.1.0 NOT_MASTER = 'not master'.freeze + # Could not contact primary error message, seen on stepdowns + # + # @since 2.2.0 + COULD_NOT_CONTACT_PRIMARY = 'could not contact primary'.freeze + # Execute a read operation with a retry. # # @api private # # @example Execute the read. @@ -81,10 +86,10 @@ # @since 2.1.0 def write_with_retry(&block) begin block.call rescue Error::OperationFailure => e - if e.message.include?(NOT_MASTER) + if e.message.include?(NOT_MASTER) || e.message.include?(COULD_NOT_CONTACT_PRIMARY) retry_operation(&block) else raise e end end