janus-ar 7.2.1 → 7.2.2
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/Gemfile.lock +2 -1
- data/lib/janus-ar/active_record/connection_adapters/janus_mysql2_adapter.rb +11 -12
- data/lib/janus-ar/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abaa44daa4820589fe37b9524a37a8190e9bb856b95498b0d66b6273ed3c8672
|
4
|
+
data.tar.gz: 100aa33fe074292a34dc758c64a122e16664a067a0117e976437dd1b415dceda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 452aebf630ed525f284d379b82d45b8f81665d44887fb21ee7d768e2310696446754df0c09b5d101dcd0142d9eab4cc3260fe0c06359e807f30652c186717fca
|
7
|
+
data.tar.gz: 9417eacddc58ec5f1bfc879b260d9a3f362f833db80f897efb634e1eade1ba185f7bc6461290551ef933971da0619652f7a24c783660d190f3985f28a65db3b3
|
data/Gemfile.lock
CHANGED
@@ -54,10 +54,10 @@ module ActiveRecord
|
|
54
54
|
def raw_execute(sql, name, async: false, allow_retry: false, materialize_transactions: true)
|
55
55
|
case where_to_send?(sql)
|
56
56
|
when :all
|
57
|
-
send_to_replica(sql, connection: :all,
|
57
|
+
send_to_replica(sql, connection: :all, name:)
|
58
58
|
super
|
59
59
|
when :replica
|
60
|
-
send_to_replica(sql, connection: :replica,
|
60
|
+
send_to_replica(sql, connection: :replica, name:)
|
61
61
|
else
|
62
62
|
Janus::Context.stick_to_primary if write_query?(sql)
|
63
63
|
Janus::Context.used_connection(:primary)
|
@@ -65,13 +65,13 @@ module ActiveRecord
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
def execute(sql)
|
68
|
+
def execute(sql, name = nil)
|
69
69
|
case where_to_send?(sql)
|
70
70
|
when :all
|
71
|
-
send_to_replica(sql, connection: :all, method: :execute)
|
71
|
+
send_to_replica(sql, connection: :all, method: :execute, name:)
|
72
72
|
super(sql)
|
73
73
|
when :replica
|
74
|
-
send_to_replica(sql, connection: :replica, method: :execute)
|
74
|
+
send_to_replica(sql, connection: :replica, method: :execute, name:)
|
75
75
|
else
|
76
76
|
Janus::Context.stick_to_primary if write_query?(sql)
|
77
77
|
Janus::Context.used_connection(:primary)
|
@@ -82,10 +82,10 @@ module ActiveRecord
|
|
82
82
|
def execute_and_free(sql, name = nil, async: false, allow_retry: false)
|
83
83
|
case where_to_send?(sql)
|
84
84
|
when :all
|
85
|
-
send_to_replica(sql, connection: :all,
|
85
|
+
send_to_replica(sql, connection: :all, name:)
|
86
86
|
super(sql, name, async:)
|
87
87
|
when :replica
|
88
|
-
send_to_replica(sql, connection: :replica,
|
88
|
+
send_to_replica(sql, connection: :replica, name:)
|
89
89
|
else
|
90
90
|
Janus::Context.stick_to_primary if write_query?(sql)
|
91
91
|
Janus::Context.used_connection(:primary)
|
@@ -123,14 +123,13 @@ module ActiveRecord
|
|
123
123
|
Janus::QueryDirector.new(sql, open_transactions).where_to_send?
|
124
124
|
end
|
125
125
|
|
126
|
-
def send_to_replica(sql, connection: nil, method: :exec_query)
|
126
|
+
def send_to_replica(sql, connection: nil, method: :exec_query, name:)
|
127
|
+
name ||= "SQL"
|
127
128
|
Janus::Context.used_connection(connection) if connection
|
128
129
|
if method == :execute
|
129
|
-
replica_connection.execute(sql)
|
130
|
-
elsif method == :raw_execute
|
131
|
-
replica_connection.execute(sql)
|
130
|
+
replica_connection.execute(sql, name)
|
132
131
|
else
|
133
|
-
replica_connection.exec_query(sql)
|
132
|
+
replica_connection.exec_query(sql, name)
|
134
133
|
end
|
135
134
|
end
|
136
135
|
|
data/lib/janus-ar/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: janus-ar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 7.2.
|
4
|
+
version: 7.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lloyd Watkin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|