activerecord_connection_reaper 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cde5ce57597f3080ebda91544487f81477143a38d99355e4eb8ee4e70d0b75e3
4
- data.tar.gz: 23d8417049ec5aa708458063d2227ef7825a62f8e54b44c64f9b083ab5f1280e
3
+ metadata.gz: e35861f63ef84b32e37c7d512ebd6eaa7a44fe55aeff51d4098b4344c81bc035
4
+ data.tar.gz: 9f7faec3c2acd37f4503510af513f7c95f30b1cef2cadf3e91e97c3360de79d2
5
5
  SHA512:
6
- metadata.gz: ebaff298730cb4acbeaff6adf2e92fb6ed31471ba178e5b50ffeff410a6cb92bcec683d1bed824ec143dd550897825eecea8f280b2f34565cf00e4d989ff1409
7
- data.tar.gz: f30372920b56840936cb5cb4bdfc29360fde15421480605ec6cbec4c2cfb5eaa74e495dad983d1bfa37cbf72b3b2e522a663ae6b8e7b48a6c43e63341713a740
6
+ metadata.gz: 79dae46aa758cc8aac4175745948d51dfcd7d3d99ed2f3eeab3c600157253b33fbd1f2cbfb311acbc72e8a01fddf8e63de4894f1ea8be178f33b9109292eb408
7
+ data.tar.gz: bfd442c2fd9f1ad749854af47a7e171f1ef1b4032afae496d89dd059bdbae9b6a6f014295327f3eb65abd13d2c6eff0a7592fdea39f3ded3eaafe8176feed43d
data/README.md CHANGED
@@ -1,39 +1,38 @@
1
- # ActiverecordConnectionReaper
1
+ # Retire old database connections just like Rails v8.1
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
3
+ Rails v8.1 introduced [some new options][1] for managing database connections,
4
+ particularly a few that are useful when running against a pooler, e.g.
5
+ PgBouncer, namely:
4
6
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/activerecord_connection_reaper`. To experiment with that code, run `bin/console` for an interactive prompt.
7
+ - **max_age**: number of seconds the pool will allow the connection to exist
8
+ before retiring it at next checkin. (default Float::INFINITY).
9
+ - **pool_jitter**: maximum reduction factor to apply to max_age interval
10
+ (default 0.2; range 0.0-1.0).
6
11
 
7
- ## Installation
8
-
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
12
+ An existing (but not well-documented) parameter that is also useful in this
13
+ scenario is **reaping_frequency**, which determines how often the reaper
14
+ thread checks for connections to retire (it defaults to 60 seconds).
10
15
 
11
- Install the gem and add to the application's Gemfile by executing:
16
+ However, there's a problem here: **this is only supported as of Rails v8.1**.
17
+ Maybe your site isn't running the latest and greatest yet. Maybe... *gasp*
18
+ maybe you're still on Ruby v2.5! What is a poor developer to do? Stop whining
19
+ and update, obviously. While you're working on that, you can use this gem.
12
20
 
13
- ```bash
14
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
15
- ```
21
+ ## Installation
16
22
 
17
- If bundler is not being used to manage dependencies, install the gem by executing:
23
+ Add this line to your application's Gemfile:
18
24
 
19
- ```bash
20
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
25
+ ```ruby
26
+ gem 'activerecord_connection_reaper'
21
27
  ```
22
28
 
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
-
33
- ## Contributing
29
+ Then install it:
34
30
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/activerecord_connection_reaper.
31
+ $ bundle install
36
32
 
37
- ## License
33
+ Once you do that, you can use the `max_age`, `pool_jitter`, and `reaping_frequency`
34
+ options in your database configuration almost as if you were actually on Rails v8.1.
35
+ Note that this gem is purposefully not compatible with Rails v8.1, to make sure you
36
+ remember to remove it when you ARE finally able to update.
38
37
 
39
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
38
+ [1]: https://api.rubyonrails.org/v8.1.3/classes/ActiveRecord/ConnectionAdapters/ConnectionPool.html#class-ActiveRecord::ConnectionAdapters::ConnectionPool-label-Options
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordConnectionReaper
4
- VERSION = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_connection_reaper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miriam Technologies