Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid new connections to the primary node. #35

Closed
wants to merge 2 commits into from

Commits on Jul 19, 2021

  1. Configuration menu
    Copy the full SHA
    6ed21d4 View commit details
    Browse the repository at this point in the history
  2. Avoid new connections to the primary node.

    `Standby::Base.inside_transaction?` uses `ActiveRecord::Base.connection`
    on the primary to check whether access to the standby is occurring from
    within a transaction. `ActiveRecord::Base.connection` looks for a cached
    connection belonging to the current thread and, if it doesn't find one,
    attempts to checkout a connection from the connection pool. If the
    connection pool is exhausted, it blocks for up to
    `ConnectionPool#checkout_timeout` (default 5 seconds).
    
    This change skips the transaction check if a connection has not been
    cached for the current thread. The assumption is there cannot be a
    current transaction without a current connection.
    nicholasdower committed Jul 19, 2021
    Configuration menu
    Copy the full SHA
    228d33f View commit details
    Browse the repository at this point in the history