fresh_connection 3.0.2 → 3.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -6
- data/README.md +10 -0
- data/fresh_connection.gemspec +1 -1
- data/lib/fresh_connection/extend/ar_resolver.rb +3 -1
- data/lib/fresh_connection/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a42d31d4d7dd4dff53494ddcb9e0b79162c4b4e0dd21dcbb49f58de3eb16de8a
|
4
|
+
data.tar.gz: eeb1e26a61e73dc041b9e1e41722eb98bd509a0eac919033353c941a8a4fd7b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dad510ed81c9a392cdecad5d30a1183bf21df98d82be8b3f6a8828a5d88ea507cd0bcf0fe49d43ae00bb7d32ad9ebf027d759a2276c9561f45dc66bef6ee4533
|
7
|
+
data.tar.gz: a9983d1bb6cb5f71ca75da62d05d49a09ef1a2105ca07990a16a5a4b89bbdb7f7e27fc4ad068914e8c9f5ccff9d1b55f1dde2e78c9c734be234d8a1d3375663f
|
data/.travis.yml
CHANGED
@@ -1,6 +1,4 @@
|
|
1
1
|
language: ruby
|
2
|
-
before_install:
|
3
|
-
- gem install bundler
|
4
2
|
services:
|
5
3
|
- mysql
|
6
4
|
- postgresql
|
@@ -12,10 +10,10 @@ before_script:
|
|
12
10
|
- psql -c 'create database fresh_connection_test_replica2;' -U postgres
|
13
11
|
cache: bundler
|
14
12
|
rvm:
|
15
|
-
- 2.
|
16
|
-
- 2.
|
17
|
-
- 2.
|
18
|
-
- 2.
|
13
|
+
- 2.3.8
|
14
|
+
- 2.4.5
|
15
|
+
- 2.5.3
|
16
|
+
- 2.6.0
|
19
17
|
gemfile:
|
20
18
|
- gemfiles/rails50.gemfile
|
21
19
|
- gemfiles/rails51.gemfile
|
data/README.md
CHANGED
@@ -31,6 +31,16 @@ FreshConnction connects one or more configured DB replicas, or with multiple rep
|
|
31
31
|
|
32
32
|
If you wish to use multiple DB replicas on any given connection but do not have a load balancer (such as [`pgbouncer`](https://pgbouncer.github.io) for Posgres databases), you can use [EbisuConnection](https://github.com/tsukasaoishi/ebisu_connection).
|
33
33
|
|
34
|
+
### Failover
|
35
|
+
FreshConnection assumes that there is a load balancer in front of multi replica servers.
|
36
|
+
When what happens one of the replicas is unreachable for any reason, FreshConnection will try three retries to access to a replica via a load balancer.
|
37
|
+
|
38
|
+
Removing a trouble replica from a cluster is a work of the load balancer.
|
39
|
+
FreshConnection expects the load balancer to work during three retries.
|
40
|
+
|
41
|
+
If you would like access to multi replica servers without a load balancer, you should use [EbisuConnection](https://github.com/tsukasaoishi/ebisu_connection).
|
42
|
+
EbisuConnection has functions of load balancer.
|
43
|
+
|
34
44
|
## Usage
|
35
45
|
### Access to the DB Replica
|
36
46
|
Read queries are automatically connected to the DB replica.
|
data/fresh_connection.gemspec
CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
|
|
23
23
|
|
24
24
|
spec.add_dependency 'activerecord', '>= 5.0.0', '< 5.3'
|
25
25
|
spec.add_dependency 'activesupport', '>= 5.0.0', '< 5.3'
|
26
|
-
spec.add_dependency 'concurrent-ruby', '~> 1.0
|
26
|
+
spec.add_dependency 'concurrent-ruby', '~> 1.0'
|
27
27
|
|
28
28
|
spec.add_development_dependency 'mysql2', '>= 0.3.18', '< 0.6.0'
|
29
29
|
spec.add_development_dependency 'pg', '>= 0.18', '< 2.0'
|
@@ -7,12 +7,14 @@ module FreshConnection
|
|
7
7
|
specification = super
|
8
8
|
|
9
9
|
case specification.config[:adapter].to_s
|
10
|
-
when "mysql2"
|
10
|
+
when "mysql", "mysql2"
|
11
11
|
require 'fresh_connection/extend/adapters/m2_adapter'
|
12
12
|
__extend_adapter_by_fc(::ActiveRecord::ConnectionAdapters::Mysql2Adapter, M2Adapter)
|
13
13
|
when "postgresql"
|
14
14
|
require 'fresh_connection/extend/adapters/pg_adapter'
|
15
15
|
__extend_adapter_by_fc(::ActiveRecord::ConnectionAdapters::PostgreSQLAdapter, PgAdapter)
|
16
|
+
else
|
17
|
+
raise NotImplementedError, "This adapter('#{specification.config[:adapter]}') is not supported. If you specified the mysql or postgres adapter, it's probably a bug in FreshConnection. Please teach me (https://github.com/tsukasaoishi/fresh_connection/issues/new)"
|
16
18
|
end
|
17
19
|
|
18
20
|
specification
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fresh_connection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tsukasa OISHI
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -56,14 +56,14 @@ dependencies:
|
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: 1.0
|
59
|
+
version: '1.0'
|
60
60
|
type: :runtime
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: 1.0
|
66
|
+
version: '1.0'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: mysql2
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|