switchman 4.2.0 → 4.2.1

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: cfb4e89f881628a5d90c8f309ddf587fdc5bfebe5bc7985c79fea9dd06e7168c
4
- data.tar.gz: baa3202cd9fb68347d71d43adecdbe3124fe3f4f604558f92546e8fa5c5b4773
3
+ metadata.gz: 3de3ef5f2ede9dffce78d116f3e5a8bef26ff3b9430057a85020c09838716c8e
4
+ data.tar.gz: e2fa7136ae05fa728a543734a914b792ed052ee27ccc784d426a5be8fea9c4ab
5
5
  SHA512:
6
- metadata.gz: c351d3ff898e668ac7a8c8ab40e9cf2249f428a2d2bbc9a16573334e1599cb9bcac20a47a3534e70b7900fd76ca55f6f4a8625c9dc7c8bb3ef1b4ade95a17ff3
7
- data.tar.gz: e3205573c3bbf8d8bf8a1e87beaaaed1adc2dba268f53ec1bac8c870f29f51ecdce923028eaa8528cffb9250965fc7b72d8d2dce4882c63edb0ad0d66d624a57
6
+ metadata.gz: e36f968755b4e866200e78dba86406b821822eaec1ce21409d200647363bed80909a4344c8e4872af346c76bb5b8140ce82537dd57c559823f14c527a9fd6a5d
7
+ data.tar.gz: ae78558b30d154e80da947897539e99e9f1fdb8a5311444e7d40066113807d3ecfd55669e0962c293c3bb45c16e7ce96414c679f44984325c8eebdf09005fa96
@@ -19,10 +19,18 @@ module Switchman
19
19
 
20
20
  def initialize(*args)
21
21
  super
22
- @instrumenter = Switchman::ShardedInstrumenter.new(@instrumenter, self)
22
+
23
+ @instrumenter = Switchman::ShardedInstrumenter.new(@instrumenter, self) if ::Rails.version < "8.0"
24
+
23
25
  @last_query_at = Time.now
24
26
  end
25
27
 
28
+ if ::Rails.version >= "8.0"
29
+ def instrumenter # :nodoc:
30
+ @instrumenter ||= Switchman::ShardedInstrumenter.new(::ActiveSupport::Notifications.instrumenter, self)
31
+ end
32
+ end
33
+
26
34
  def quote_local_table_name(name)
27
35
  quote_table_name(name)
28
36
  end
@@ -13,10 +13,16 @@ module Switchman
13
13
  # when we might be doing a query while defining attribute methods,
14
14
  # so just avoid logging then
15
15
  if shard.is_a?(Shard) && Shard.instance_variable_get(:@attribute_methods_generated)
16
+ env = if ::Rails.version < "8.0"
17
+ @shard_host.pool.connection_class&.current_role
18
+ else
19
+ @shard_host.pool.connection_descriptor.name.constantize&.current_role
20
+ end
21
+
16
22
  payload[:shard] = {
17
23
  database_server_id: shard.database_server.id,
18
24
  id: shard.id,
19
- env: @shard_host.pool.connection_class&.current_role
25
+ env: env
20
26
  }
21
27
  end
22
28
  super
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchman
4
- VERSION = "4.2.0"
4
+ VERSION = "4.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2025-08-25 00:00:00.000000000 Z
13
+ date: 2025-09-12 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord