switchman 3.6.6 → 3.6.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8c9938f088ef1bcce6ba0647f9e46db87d777a8b654a832bc82dbb24be2bea0a
4
- data.tar.gz: 22087e848ed37bf0551999ea9923248688a5194501be7d02d07e2a2448fe701d
3
+ metadata.gz: 9c258da7abce6b4b34bb1dac83e352aeb4548776a34820969460c31b4c61674e
4
+ data.tar.gz: '0512961dad99c3041d461ed8e6e183a998d70cd4229712b7246099e8c408c139'
5
5
  SHA512:
6
- metadata.gz: 21931a6cedf1dfb74539e19657a9df58becb94e098a94423a059c3961ee042f36a66b547c40bc62ca66b17498235330743f12f8bc3d75a1c6f5172b25df15d37
7
- data.tar.gz: 0220b63454657b7cddd89100a2d1ebe940369d6c0749345153912676741eba50f48d6ec1ae5e68f1eed08c46f4fa4e6c77032a0b0839f46645e7a4b376ef9ac0
6
+ metadata.gz: 494681d5982a2035e85f3058162a7864b1afc89df2c29ba0d95d99bc9408fabe23b4f762b706946152a3f5e983320bf0c2704c0cc66ad13367ae062c9d20843f
7
+ data.tar.gz: ce04f224bd153d4de41df5d2b8ec28b22c25e591eb6465ffcf6e8c1a5e831992981a6fc8c8e86130914ca5d91c6442c2b4335c76f374b61ae24bfc21ad838adc
@@ -22,12 +22,14 @@ module Switchman
22
22
 
23
23
  def lookup_store(*store_options)
24
24
  store = super
25
- # can't use defined?, because it's a _ruby_ autoloaded constant,
26
- # so just checking that will cause it to get required
27
- if store.instance_of?(ActiveSupport::Cache::RedisCacheStore) &&
28
- !::ActiveSupport::Cache::RedisCacheStore <= RedisCacheStore
25
+ # must use the string name, otherwise it will try to auto-load the constant
26
+ # and we don't want to require redis in this file (since it's not a hard dependency)
27
+ # rubocop:disable Style/ClassEqualityComparison
28
+ if store.class.name == "ActiveSupport::Cache::RedisCacheStore" &&
29
+ !(::ActiveSupport::Cache::RedisCacheStore <= RedisCacheStore)
29
30
  ::ActiveSupport::Cache::RedisCacheStore.prepend(RedisCacheStore)
30
31
  end
32
+ # rubocop:enable Style/ClassEqualityComparison
31
33
  store.options[:namespace] ||= -> { Shard.current.default? ? nil : "shard_#{Shard.current.id}" }
32
34
  store
33
35
  end
@@ -36,7 +38,7 @@ module Switchman
36
38
  module RedisCacheStore
37
39
  def clear(namespace: nil, **)
38
40
  # RedisCacheStore tries to be smart and only clear the cache under your namespace, if you have one set
39
- # unfortunately, it uses the keys command, which is extraordinarily inefficient in a large redis instance
41
+ # unfortunately, it doesn't work using redis clustering because of the way redis keys are distributed
40
42
  # fortunately, we can assume we control the entire instance, because we set up the namespacing, so just
41
43
  # always unset it temporarily for clear calls
42
44
  namespace = nil # rubocop:disable Lint/ShadowedArgument
@@ -126,6 +126,7 @@ module Switchman
126
126
  ds.shards.delete_all unless use_transactional_tests
127
127
  ds.destroy
128
128
  end
129
+ ds.remove_instance_variable(:@primary_shard_id) if ds.instance_variable_defined?(:@primary_shard_id)
129
130
  end
130
131
  end
131
132
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Switchman
4
- VERSION = "3.6.6"
4
+ VERSION = "3.6.8"
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: 3.6.6
4
+ version: 3.6.8
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: 2024-08-20 00:00:00.000000000 Z
13
+ date: 2025-01-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activerecord