No commit activity in last 3 years
No release in over 3 years
MongoMapper replicaset fallback mechanism
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

 Project Readme

MongomapperFallback

At this time, MongoMapper not have any mechanism to properly handle Replicaset connection failures (commonly master falls down and arbiter was not selected any server yet).

MongomapperFallback is a alternative to handle these failures with a simple retry mechanism.

Installation

Add this line to your application's Gemfile:

gem 'mongomapper_fallback'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mongomapper_fallback

Usage

# example.rb
class Example
  include MongomapperFallback

  def execute
    logger = Logger.new('your_logfile_here.log') # or Slogger

    # available options:
    # - retry_limit: limit of retries that will be executed
    # - sig_quit: sends a QUIT to current process before retry failed code again

    replicaset_safe_run!(logger, retry_limit: 10, sig_quit: true) do
      # perform any operation
    end
  end
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request