sidekiq-pauzer 4.0.0 → 4.1.0

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: faa9b7eb1c6af34af0cf7dd5bfae8b83222d5026f95dccc2e1e9f388185b7b27
4
- data.tar.gz: 3666d0d75e3ffffee92a34d6c3f3e6adff13419426adad43889948ee14b8cf7f
3
+ metadata.gz: c4907f516e85f120c7f3bab0c18d1832995d3b31cfd788fb4f3bed2258c9cf0b
4
+ data.tar.gz: f697759608b23f58eec74cae99d0c5ec6773f1f7304b87e5f34d4e3dd437f0a3
5
5
  SHA512:
6
- metadata.gz: 2a236f74b6012c86b127149aaf34d08b0626beae33b25272d845d2bce0b18316d841ae540eb2a7ba09325981ae7f36eec389dc46546a15b385d694448d88bb98
7
- data.tar.gz: 5738d9f7ef1fef9d27270ab557dc58255d79afeeb08f16f14ace57196835efb39ac282954930f9460124e46bf340be288c5842ecb995be4db87bf2e574b71558
6
+ metadata.gz: a89c0004ea1ef1bd6684e1778194a3ec63be336df0a46a19870c3a3cd97e12d9a24e00c448562fd1e095de0c1ad94bbce2a299d640e2fcad16a6fddac8077463
7
+ data.tar.gz: a13a58fc1cd1fdadfa91ad211c0095f85e7b48be126c73b169cf7fa645fd6866df81ea5be845097f4ece5acdbd9c910ed49af95b113e59b6a428dcb6f9783e32
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2023 Alexey Zapparov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -12,7 +12,8 @@ module Sidekiq
12
12
 
13
13
  # @param config [Config]
14
14
  def initialize(config)
15
- @names = Concurrent::Array.new
15
+ @mutex = Mutex.new
16
+ @names = [].freeze
16
17
  @redis_key = config.redis_key
17
18
  @refresher = initialize_refresher(config.refresh_rate)
18
19
  end
@@ -20,7 +21,7 @@ module Sidekiq
20
21
  def each(&block)
21
22
  return to_enum __method__ unless block
22
23
 
23
- @names.dup.each(&block)
24
+ @names.each(&block)
24
25
 
25
26
  self
26
27
  end
@@ -28,14 +29,12 @@ module Sidekiq
28
29
  # @param name [#to_s]
29
30
  def pause!(name)
30
31
  Sidekiq.redis { |conn| conn.call("SADD", @redis_key, name.to_s) }
31
-
32
32
  refresh
33
33
  end
34
34
 
35
35
  # @param name [#to_s]
36
36
  def unpause!(name)
37
37
  Sidekiq.redis { |conn| conn.call("SREM", @redis_key, name.to_s) }
38
-
39
38
  refresh
40
39
  end
41
40
 
@@ -70,14 +69,9 @@ module Sidekiq
70
69
  end
71
70
 
72
71
  def refresh
73
- names = Sidekiq.redis do |conn|
74
- # Cursor is not atomic, so there may be duplicates because of
75
- # concurrent update operations
76
- # See: https://redis.io/commands/scan/#scan-guarantees
77
- conn.sscan(@redis_key).to_a.uniq.each(&:freeze)
78
- end
72
+ names = Sidekiq.redis { |conn| conn.call("SMEMBERS", @redis_key).to_a }
79
73
 
80
- @names.replace(names)
74
+ @mutex.synchronize { @names = names.each(&:freeze).freeze }
81
75
 
82
76
  self
83
77
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Sidekiq
4
4
  module Pauzer
5
- VERSION = "4.0.0"
5
+ VERSION = "4.1.0"
6
6
  end
7
7
  end
@@ -12,19 +12,19 @@ require_relative "./pauzer/version"
12
12
 
13
13
  begin
14
14
  require "sidekiq-ent/version"
15
- raise "sidekiq-pauzer is incompatible with Sidekiq Enterprise"
16
15
  rescue LoadError
17
16
  # All good - no compatibility issues
18
17
  end
19
18
 
20
19
  begin
21
20
  require "sidekiq/pro/version"
22
-
23
- raise "sidekiq-pauzer is incompatible with Sidekiq Pro"
24
21
  rescue LoadError
25
22
  # All good - no compatibility issues
26
23
  end
27
24
 
25
+ raise "sidekiq-pauzer is incompatible with Sidekiq Pro" if Sidekiq.pro?
26
+ raise "sidekiq-pauzer is incompatible with Sidekiq Enterprise" if Sidekiq.ent?
27
+
28
28
  module Sidekiq
29
29
  module Pauzer
30
30
  MUTEX = Mutex.new
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-pauzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Zapparov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-17 00:00:00.000000000 Z
11
+ date: 2023-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -45,6 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - LICENSE.txt
48
49
  - README.adoc
49
50
  - lib/sidekiq-pauzer.rb
50
51
  - lib/sidekiq/pauzer.rb
@@ -62,9 +63,9 @@ licenses:
62
63
  - MIT
63
64
  metadata:
64
65
  homepage_uri: https://gitlab.com/ixti/sidekiq-pauzer
65
- source_code_uri: https://gitlab.com/ixti/sidekiq-pauzer/tree/v4.0.0
66
+ source_code_uri: https://gitlab.com/ixti/sidekiq-pauzer/tree/v4.1.0
66
67
  bug_tracker_uri: https://gitlab.com/ixti/sidekiq-pauzer/issues
67
- changelog_uri: https://gitlab.com/ixti/sidekiq-pauzer/blob/v4.0.0/CHANGES.md
68
+ changelog_uri: https://gitlab.com/ixti/sidekiq-pauzer/blob/v4.1.0/CHANGES.md
68
69
  rubygems_mfa_required: 'true'
69
70
  post_install_message:
70
71
  rdoc_options: []