modis 4.3.0 → 4.3.1

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: 9a9d3d05277e2ddf26b7c14547b3e03f37cb6fbb771ba9b2a6b61acce6485bd9
4
- data.tar.gz: 031d2f34a15d5f077b5b01c2e4286b73285ed2171f4029577c2d812a22f6da6d
3
+ metadata.gz: 4490e45322b9ae24bb78a01190616971ff18fd0ee14030493a2cb76f1496d8ac
4
+ data.tar.gz: 135acda908b954b448aff439a4fd6663f06297da29b7bc8ce936c2f153696e05
5
5
  SHA512:
6
- metadata.gz: 9b76390c567d8ba5495c226cb7425372797fe9b3d5e2d2a07a8f891bed7e5aa4f3c66d84f54c6cac7814f07f156e958687a62da8179c4d1922da2efb065412c1
7
- data.tar.gz: dba384ff8ad647615016ed340c21e72088d45b1186b91e96f28c579b73ff7d45cd2616b10c70d42fcb17e1f4cfe4889074c0eb8a6ab41b0e92082d83d663c026
6
+ metadata.gz: 656b9746bb1381ae3eee2cec837e3a1adebcd505eea7cb3289f660d8bfa17371e4defabb567898000b4e1a5a49775205deff1081a00299422e125360a3a186b2
7
+ data.tar.gz: 49c2d453ca3079306ee51fc9d97bda1330d10871a205a57b22ca70260dc746b8d8c589fc66750bb09b8af7aa6421faf8fa1e3fb79ae2035411c32033fd328bb3
@@ -1,3 +1,3 @@
1
1
  user=rpush
2
2
  project=modis
3
- future-release=v4.1.0
3
+ future-release=v4.3.1
data/CHANGELOG.md CHANGED
@@ -1,8 +1,20 @@
1
1
  # Changelog
2
2
 
3
- ## [v4.1.0](https://github.com/rpush/modis/tree/v4.1.0) (2024-07-31)
3
+ ## [v4.3.1](https://github.com/rpush/modis/tree/v4.3.1) (2024-08-01)
4
4
 
5
- [Full Changelog](https://github.com/rpush/modis/compare/v4.2.0...v4.1.0)
5
+ [Full Changelog](https://github.com/rpush/modis/compare/v4.3.0...v4.3.1)
6
+
7
+ **Closed issues:**
8
+
9
+ - Release 4.3.0 breaks the Rpush initialization [\#50](https://github.com/rpush/modis/issues/50)
10
+
11
+ **Merged pull requests:**
12
+
13
+ - Restore backwards compatibility broken in 4.3.0 [\#51](https://github.com/rpush/modis/pull/51) ([benlangfeld](https://github.com/benlangfeld))
14
+
15
+ ## [v4.3.0](https://github.com/rpush/modis/tree/v4.3.0) (2024-07-31)
16
+
17
+ [Full Changelog](https://github.com/rpush/modis/compare/v4.2.0...v4.3.0)
6
18
 
7
19
  **Merged pull requests:**
8
20
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- modis (4.3.0)
4
+ modis (4.3.1)
5
5
  activemodel (>= 5.2)
6
6
  activesupport (>= 5.2)
7
7
  connection_pool (>= 2)
@@ -9,8 +9,8 @@ module Modis
9
9
  end
10
10
 
11
11
  class << self
12
- attr_reader :config
12
+ def config
13
+ @config ||= Configuration.new
14
+ end
13
15
  end
14
-
15
- @config = Configuration.new
16
16
  end
data/lib/modis/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Modis
4
- VERSION = '4.3.0'
4
+ VERSION = '4.3.1'
5
5
  end
data/lib/modis.rb CHANGED
@@ -18,11 +18,14 @@ require 'modis/index'
18
18
  require 'modis/model'
19
19
 
20
20
  module Modis
21
- @mutex = Mutex.new
22
21
  class << self
23
22
  attr_writer :connection_pool_size, :connection_pool_timeout,
24
23
  :connection_pools
25
24
 
25
+ def mutex
26
+ @mutex ||= Mutex.new
27
+ end
28
+
26
29
  def redis_options
27
30
  @redis_options ||= { default: {} }
28
31
  end
@@ -31,7 +34,20 @@ module Modis
31
34
  if options.is_a?(Hash) && options.values.first.is_a?(Hash)
32
35
  @redis_options = options.transform_values(&:dup)
33
36
  else
34
- @redis_options[:default] = options
37
+ redis_options[:default] = options
38
+ end
39
+ end
40
+
41
+ def reset!
42
+ connection_pools.each do |key, _|
43
+ with_connection(key) do |connection|
44
+ keys = connection.keys "#{config.namespace}:*"
45
+ connection.del(*keys) unless keys.empty?
46
+ end
47
+ end
48
+ instance_variables.each do |var|
49
+ instance_variable_set(var, nil)
50
+ remove_instance_variable(var)
35
51
  end
36
52
  end
37
53
 
@@ -49,7 +65,7 @@ module Modis
49
65
 
50
66
  def connection_pool(pool_name = :default)
51
67
  connection_pools[pool_name] ||= begin
52
- @mutex.synchronize do
68
+ mutex.synchronize do
53
69
  ConnectionPool.new(
54
70
  size: connection_pool_size,
55
71
  timeout: connection_pool_timeout
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'spec_helper'
4
+
3
5
  module MultiRedisSpec
4
6
  class DefaultUserModel
5
7
  include Modis::Model
data/spec/spec_helper.rb CHANGED
@@ -14,18 +14,12 @@ require 'modis'
14
14
 
15
15
  Redis.raise_deprecations = true if Gem.loaded_specs['redis'].version >= Gem::Version.new('4.6.0')
16
16
 
17
- Modis.configure do |config|
18
- config.namespace = 'modis'
19
- end
20
-
21
17
  RSpec.configure do |config|
22
18
  config.after :each do
23
19
  RSpec::Mocks.space.proxy_for(Modis).reset
24
- Modis.connection_pools.each do |key, _|
25
- Modis.with_connection(key) do |connection|
26
- keys = connection.keys "#{Modis.config.namespace}:*"
27
- connection.del(*keys) unless keys.empty?
28
- end
20
+ Modis.reset!
21
+ Modis.configure do |modis_config|
22
+ modis_config.namespace = 'modis'
29
23
  end
30
24
  end
31
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modis
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.0
4
+ version: 4.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian Leitch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-31 00:00:00.000000000 Z
11
+ date: 2024-08-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel