Created
March 30, 2012 21:40
-
-
Save justindossey/2255384 to your computer and use it in GitHub Desktop.
Flip read_secondary via MongoMapper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trap('USR2') do | |
# reconnect to MongoDB with read_secondary reversed | |
result=MongoMapper.connection.instance_eval('@read_secondary = !@read_secondary') | |
logger.notice("#{Time.now}: now reading from #{result ? 'secondary' : 'primary'}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment