knockoff 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +2 -1
- data/CHANGELOG.md +5 -1
- data/README.md +3 -3
- data/lib/knockoff/active_record/relation.rb +3 -3
- data/lib/knockoff/config.rb +10 -3
- data/lib/knockoff/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 95bb6904e4373aa3b026fc1e950b8f5cc9081a4abd174e58ef4ed521824fb5bb
|
4
|
+
data.tar.gz: 6bfeeb88cb514854c2e550f531d65c76c160bcac1225b741deab01f6183e0abf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2afdaf7285a09cb98a2946f19313160d84fe57208e86e00278732c391143c524093ab40e241a4db0c59711db789737b64e4958f2667fec6c7727f006e584663
|
7
|
+
data.tar.gz: ee421e025448df4043319d90be8ed9aa8f9e2979d633feaa29d8876ea8bfb24aa1411d6103aeb65d50cb25f5c549732165d60330355bfe944f53fdc6bb14f955
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# Knockoff
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.
|
3
|
+
[![Build Status](https://travis-ci.com/joinhandshake/knockoff.svg?branch=master)](https://travis-ci.com/github/joinhandshake/knockoff)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/knockoff.svg)](https://badge.fury.io/rb/knockoff)
|
5
5
|
|
6
6
|
A gem for easily using read replicas.
|
7
7
|
|
8
|
-
:handshake: Battle tested at [Handshake](https://joinhandshake.com/
|
8
|
+
:handshake: Battle tested at [Handshake](https://joinhandshake.com/)
|
9
9
|
|
10
10
|
## Library Goals
|
11
11
|
|
@@ -17,7 +17,7 @@ A gem for easily using read replicas.
|
|
17
17
|
|
18
18
|
## Supported Versions
|
19
19
|
|
20
|
-
Knockoff supports Rails 4 and
|
20
|
+
Knockoff supports Rails 4, 5 and 6
|
21
21
|
|
22
22
|
## Installation
|
23
23
|
|
@@ -5,11 +5,11 @@ module ActiveRecord
|
|
5
5
|
# Supports queries like User.on_replica.to_a
|
6
6
|
alias_method :exec_queries_without_knockoff, :exec_queries
|
7
7
|
|
8
|
-
def exec_queries
|
8
|
+
def exec_queries(&block)
|
9
9
|
if knockoff_target == :replica
|
10
|
-
Knockoff.on_replica { exec_queries_without_knockoff }
|
10
|
+
Knockoff.on_replica { exec_queries_without_knockoff(&block) }
|
11
11
|
else
|
12
|
-
exec_queries_without_knockoff
|
12
|
+
exec_queries_without_knockoff(&block)
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
data/lib/knockoff/config.rb
CHANGED
@@ -96,10 +96,17 @@ module Knockoff
|
|
96
96
|
|
97
97
|
# Store the hash in configuration and use it when we establish the connection later.
|
98
98
|
key = "knockoff_replica_#{index}"
|
99
|
-
|
99
|
+
config = replica_config.merge(uri_config)
|
100
100
|
|
101
|
-
ActiveRecord::
|
102
|
-
|
101
|
+
if ActiveRecord::VERSION::MAJOR >= 6
|
102
|
+
full_config = ActiveRecord::Base.configurations.to_h.merge(key => config)
|
103
|
+
|
104
|
+
ActiveRecord::Base.configurations = full_config
|
105
|
+
@replicas_configurations[key] = config
|
106
|
+
else
|
107
|
+
ActiveRecord::Base.configurations[key] = config
|
108
|
+
@replicas_configurations[key] = config
|
109
|
+
end
|
103
110
|
rescue URI::InvalidURIError
|
104
111
|
Rails.logger.info "LOG NOTIFIER: Invalid URL specified in follower_env_keys. Not including URI, which may result in no followers used." # URI is purposely not printed to logs
|
105
112
|
# Return a 'nil' which will be removed from
|
data/lib/knockoff/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knockoff
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Scott Ringwelski
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -140,8 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
140
|
- !ruby/object:Gem::Version
|
141
141
|
version: '0'
|
142
142
|
requirements: []
|
143
|
-
|
144
|
-
rubygems_version: 2.6.13
|
143
|
+
rubygems_version: 3.1.2
|
145
144
|
signing_key:
|
146
145
|
specification_version: 4
|
147
146
|
summary: A gem for easily using read replicas
|