Sha256: 8b202036881046af0474119500e8379b12862f986d30d97b245703d22ff2ca55
Contents?: true
Size: 722 Bytes
Versions: 1
Compression:
Stored size: 722 Bytes
Contents
module Sunspot module SessionProxy class MasterSlaveWithFailoverSessionProxy < MasterSlaveSessionProxy attr_accessor :exception def commit with_exception_handling do master_session.commit end end def search(*types, &block) [slave_session, master_session].any? do |session| with_exception_handling { session.search(*types, &block) } end or raise(exception) end private def with_exception_handling yield rescue Exception => exception Rails::Failover::ExceptionHandlerAdapter.handle(exception) self.exception = exception false end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sunspot-rails-failover-0.0.5 | lib/sunspot/session_proxy/master_slave_with_failover_session_proxy.rb |