Skip to content

Latest commit

 

History

History
33 lines (20 loc) · 1.01 KB

README.md

File metadata and controls

33 lines (20 loc) · 1.01 KB

activerecord-retry-reads

Automatically retry read queries.

Supports Rails 7.1+ and the mysql2, postgresql, sqlite3, or trilogy adapters.

Installation

In your Gemfile:

gem 'activerecord-retry-reads'

Usage

There is currently no configuration for this gem.

Why this gem?

Historically, gems like activerecord-mysql-reconnect have been used to automatically reconnect and retry queries after a disconnect from MySQL. They are not compatible with Rails >= 7.1.

Rails 7.1 added native reconnect and retry functionality, but it is extremely conservative about what queries are automatically retried. In almost every Rails app any read query is idempotent and safe to retry. If this is not true in your app, do not use this gem!

This gem expands the automatic retry functionality added in Rails 7.1 to enable retries for every read query.

Testing

Run tests with:

bundle exec appraisal install
bundle exec appraisal rake test