active_record_shards 3.12.0.beta1 → 3.12.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3b58db094b64e706872768e27a2c92827d182f5cde938b974de333ad99c911e2
4
- data.tar.gz: c6bd4169b99f66409c0bf8576e79bd34f567ed92e88c00abcfd4d8ce9a9d3f02
3
+ metadata.gz: ef4602ef8dd4f4da902671838cb3c81a9a894befc5ecf4f26679c637d934128e
4
+ data.tar.gz: be495688e0eb5887a65bf0679c49b2befe0de4c1505bc6d9c7d91c02595b5c87
5
5
  SHA512:
6
- metadata.gz: bbe1f3c052a2594c13c817e7fb06894b38582f4bde8656347eace28217ac349f689e4326fd3f5c941bf7075db3232c038b7ae47effdc80d0778a5304d978ae78
7
- data.tar.gz: b2fae9dd53cf66ec159a2d67eec9d65432b47dcee687111295839755e3e69c05c5f40f2805cc47ed37096479004b7d59e9c3c6b5eb5d6c7d0217363a7ebdd29d
6
+ metadata.gz: e6a568a5e3f7894a9e64319acc93991bdcd01adae5852bbe19b4e599fe66d1648fd7e13b76530b45625d78c51ed9a95ad31c37b2f4f51f11c8221132626378bc
7
+ data.tar.gz: 27a84cabdef6e4b5acaadd20a8c500e979548c103cd996d1e68198ecde2d5c021c2a66bef4f95b8acf74c1f4386295b058d15fd8d4e6bd81d55b2574ba795a47
@@ -49,22 +49,21 @@ module ActiveRecordShards
49
49
  PRIMARY = "primary".freeze
50
50
  def resolve_connection_name(sharded:, configurations:)
51
51
  resolved_shard = sharded ? shard : nil
52
-
53
- if !resolved_shard && !@on_slave
54
- return PRIMARY
55
- end
56
-
57
- @shard_names ||= {}
58
- @shard_names[ActiveRecordShards.rails_env] ||= {}
59
- @shard_names[ActiveRecordShards.rails_env][resolved_shard] ||= {}
60
- @shard_names[ActiveRecordShards.rails_env][resolved_shard][@on_slave] ||= begin
61
- s = ActiveRecordShards.rails_env.dup
62
- s << "_shard_#{resolved_shard}" if resolved_shard
63
-
64
- if @on_slave && configurations["#{s}_slave"] # fall back to master connection
65
- s << "_slave"
52
+ env = ActiveRecordShards.rails_env
53
+
54
+ @connection_names ||= {}
55
+ @connection_names[env] ||= {}
56
+ @connection_names[env][resolved_shard] ||= {}
57
+ @connection_names[env][resolved_shard][@on_slave] ||= begin
58
+ name = env.dup
59
+ name << "_shard_#{resolved_shard}" if resolved_shard
60
+ if @on_slave && configurations["#{name}_slave"]
61
+ "#{name}_slave"
62
+ else
63
+ # ActiveRecord always names its default connection pool 'primary'
64
+ # while everything else is named by the configuration name
65
+ resolved_shard ? name : PRIMARY
66
66
  end
67
- s
68
67
  end
69
68
  end
70
69
 
metadata CHANGED
@@ -1,16 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_record_shards
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.0.beta1
4
+ version: 3.12.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
+ - Benjamin Quorning
8
+ - Gabe Martin-Dempesy
9
+ - Pierre Schambacher
7
10
  - Mick Staugaard
8
11
  - Eric Chapweske
9
12
  - Ben Osheroff
10
13
  autorequire:
11
14
  bindir: bin
12
15
  cert_chain: []
13
- date: 2018-06-11 00:00:00.000000000 Z
16
+ date: 2018-06-14 00:00:00.000000000 Z
14
17
  dependencies:
15
18
  - !ruby/object:Gem::Dependency
16
19
  name: activerecord
@@ -180,9 +183,10 @@ dependencies:
180
183
  version: 0.2.0
181
184
  description: Easily run queries on shard and slave databases.
182
185
  email:
186
+ - bquorning@zendesk.com
187
+ - gabe@zendesk.com
188
+ - pschambacher@zendesk.com
183
189
  - mick@staugaard.com
184
- - eac@zendesk.com
185
- - ben@gimbo.net
186
190
  executables: []
187
191
  extensions: []
188
192
  extra_rdoc_files: []