v6.1.3.1 - Show latest stable - Superclass: Object

The Resolver class is used by the DatabaseSelector middleware to determine which database the request should use.

To change the behavior of the Resolver class in your application, create a custom resolver class that inherits from DatabaseSelector::Resolver and implements the methods that need to be changed.

By default the Resolver class will send read traffic to the replica if it’s been 2 seconds since the last write.

Constants

SEND_TO_REPLICA_DELAY = 2.seconds

Attributes

[R]context
[R]delay
[R]instrumenter

Files

  • activerecord/lib/active_record/middleware/database_selector/resolver.rb
  • activerecord/lib/active_record/middleware/database_selector/resolver/session.rb