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 +4 -4
- data/README.md +26 -27
- data/lib/activerecord_connection_reaper/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e35861f63ef84b32e37c7d512ebd6eaa7a44fe55aeff51d4098b4344c81bc035
|
|
4
|
+
data.tar.gz: 9f7faec3c2acd37f4503510af513f7c95f30b1cef2cadf3e91e97c3360de79d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 79dae46aa758cc8aac4175745948d51dfcd7d3d99ed2f3eeab3c600157253b33fbd1f2cbfb311acbc72e8a01fddf8e63de4894f1ea8be178f33b9109292eb408
|
|
7
|
+
data.tar.gz: bfd442c2fd9f1ad749854af47a7e171f1ef1b4032afae496d89dd059bdbae9b6a6f014295327f3eb65abd13d2c6eff0a7592fdea39f3ded3eaafe8176feed43d
|
data/README.md
CHANGED
|
@@ -1,39 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Retire old database connections just like Rails v8.1
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
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
|
-
|
|
14
|
-
bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
|
15
|
-
```
|
|
21
|
+
## Installation
|
|
16
22
|
|
|
17
|
-
|
|
23
|
+
Add this line to your application's Gemfile:
|
|
18
24
|
|
|
19
|
-
```
|
|
20
|
-
gem
|
|
25
|
+
```ruby
|
|
26
|
+
gem 'activerecord_connection_reaper'
|
|
21
27
|
```
|
|
22
28
|
|
|
23
|
-
|
|
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
|
-
|
|
31
|
+
$ bundle install
|
|
36
32
|
|
|
37
|
-
|
|
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
|
-
|
|
38
|
+
[1]: https://api.rubyonrails.org/v8.1.3/classes/ActiveRecord/ConnectionAdapters/ConnectionPool.html#class-ActiveRecord::ConnectionAdapters::ConnectionPool-label-Options
|