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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe497cf684bea34f818de566d7c7f88ed3c018b004a8d5b8787c05632b1cb0ec
4
- data.tar.gz: df381e8a3639ca92c5b6775939c9ecf9ab157a390f78048de9cf769b8c17113a
3
+ metadata.gz: abaa44daa4820589fe37b9524a37a8190e9bb856b95498b0d66b6273ed3c8672
4
+ data.tar.gz: 100aa33fe074292a34dc758c64a122e16664a067a0117e976437dd1b415dceda
5
5
  SHA512:
6
- metadata.gz: e7097e43fd387f258d638e073fde928e8b6c16f58d56dbcdff03ea37cc5c474a18b4326184d479878081e6e2995fcd165d429abe2d47c419fe716300f4d90ca8
7
- data.tar.gz: 660f0a7cac355114fc105f190053c1daf56e9c1fde208e7ba18442a42413c6c357245defeeeb5f469d42377618c84127f671c825ff568ed17859c0126c7a1a7c
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)
@@ -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, 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)
@@ -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
 
@@ -5,7 +5,7 @@ module Janus
5
5
  module VERSION
6
6
  MAJOR = 7
7
7
  MINOR = 2
8
- PATCH = 1
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.1
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-02-24 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