janus-ar 7.2.0 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d9a0e04cbb2ece10c1a3fec2d0c1036788eaa290e36f5af3ea78812e8de6ac6c
4
- data.tar.gz: 4cdf47f493d980f0c90b2bdb1d45468163cc58bf7d88c60956dc12e62dd2983d
3
+ metadata.gz: abaa44daa4820589fe37b9524a37a8190e9bb856b95498b0d66b6273ed3c8672
4
+ data.tar.gz: 100aa33fe074292a34dc758c64a122e16664a067a0117e976437dd1b415dceda
5
5
  SHA512:
6
- metadata.gz: 1cc3b11d2a1f77ffd74c13fb61d9a6b012fa95375c030f93317be8a02052cc899c3750dbda3273efc4344e9bfc259c22d385842d9ad829ebde770ec3c911d969
7
- data.tar.gz: 2abaface3c1b02a535a3b467b047ed03ab67ee5b57396363253fa975ab89b39cffaf0386b08968b9001f86623779b92ef31189cd91598242a31934ae1b71e8d9
6
+ metadata.gz: 452aebf630ed525f284d379b82d45b8f81665d44887fb21ee7d768e2310696446754df0c09b5d101dcd0142d9eab4cc3260fe0c06359e807f30652c186717fca
7
+ data.tar.gz: 9417eacddc58ec5f1bfc879b260d9a3f362f833db80f897efb634e1eade1ba185f7bc6461290551ef933971da0619652f7a24c783660d190f3985f28a65db3b3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- janus-ar (7.2.0)
4
+ janus-ar (7.2.2)
5
5
  activerecord (~> 7.2)
6
6
 
7
7
  GEM
@@ -103,6 +103,7 @@ GEM
103
103
 
104
104
  PLATFORMS
105
105
  arm64-darwin-23
106
+ x86_64-darwin-19
106
107
  x86_64-linux
107
108
 
108
109
  DEPENDENCIES
@@ -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, method: :raw_execute)
57
+ send_to_replica(sql, connection: :all, name:)
58
58
  super
59
59
  when :replica
60
- send_to_replica(sql, connection: :replica, method: :raw_execute)
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)
@@ -79,17 +79,17 @@ module ActiveRecord
79
79
  end
80
80
  end
81
81
 
82
- def execute_and_free(sql, name = nil, async: false)
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, method: :execute)
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, method: :execute)
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)
92
- super(sql, name, async:)
92
+ super(sql, name, async:, allow_retry:)
93
93
  end
94
94
  end
95
95
 
@@ -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
 
@@ -75,17 +75,17 @@ module ActiveRecord
75
75
  end
76
76
  end
77
77
 
78
- def execute_and_free(sql, name = nil, async: false)
78
+ def execute_and_free(sql, name = nil, async: false, allow_retry: false)
79
79
  case where_to_send?(sql)
80
80
  when :all
81
81
  send_to_replica(sql, connection: :all, method: :execute)
82
- super(sql, name, async:)
82
+ super(sql, name, async:, allow_retry:)
83
83
  when :replica
84
84
  send_to_replica(sql, connection: :replica, method: :execute)
85
85
  else
86
86
  Janus::Context.stick_to_primary if write_query?(sql)
87
87
  Janus::Context.used_connection(:primary)
88
- super(sql, name, async:)
88
+ super(sql, name, async:, allow_retry:)
89
89
  end
90
90
  end
91
91
 
@@ -5,7 +5,7 @@ module Janus
5
5
  module VERSION
6
6
  MAJOR = 7
7
7
  MINOR = 2
8
- PATCH = 0
8
+ PATCH = 2
9
9
  PRE = nil
10
10
 
11
11
  def self.to_s
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.0
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: 2024-08-28 00:00:00.000000000 Z
11
+ date: 2025-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
241
  - !ruby/object:Gem::Version
242
242
  version: '0'
243
243
  requirements: []
244
- rubygems_version: 3.5.11
244
+ rubygems_version: 3.5.23
245
245
  signing_key:
246
246
  specification_version: 4
247
247
  summary: Read/Write proxy for ActiveRecord using primary/replica databases