sidekiq-pauzer 3.0.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.adoc +1 -5
- data/lib/sidekiq/pauzer/patches/basic_fetch.rb +21 -0
- data/lib/sidekiq/pauzer/patches/queue.rb +2 -4
- data/lib/sidekiq/pauzer/queues.rb +9 -12
- data/lib/sidekiq/pauzer/version.rb +1 -1
- data/lib/sidekiq/pauzer.rb +1 -3
- metadata +6 -6
- data/lib/sidekiq/pauzer/basic_fetch.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: faa9b7eb1c6af34af0cf7dd5bfae8b83222d5026f95dccc2e1e9f388185b7b27
|
4
|
+
data.tar.gz: 3666d0d75e3ffffee92a34d6c3f3e6adff13419426adad43889948ee14b8cf7f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a236f74b6012c86b127149aaf34d08b0626beae33b25272d845d2bce0b18316d841ae540eb2a7ba09325981ae7f36eec389dc46546a15b385d694448d88bb98
|
7
|
+
data.tar.gz: 5738d9f7ef1fef9d27270ab557dc58255d79afeeb08f16f14ace57196835efb39ac282954930f9460124e46bf340be288c5842ecb995be4db87bf2e574b71558
|
data/README.adoc
CHANGED
@@ -28,10 +28,6 @@ Sidekiq::Pauzer.configure do |config|
|
|
28
28
|
# Default: 10
|
29
29
|
config.refresh_rate = 15
|
30
30
|
end
|
31
|
-
|
32
|
-
Sidekiq.configure_server do |config|
|
33
|
-
config[:fetch_class] = Sidekiq::Pauzer::BasicFetch
|
34
|
-
end
|
35
31
|
----
|
36
32
|
|
37
33
|
=== API
|
@@ -73,7 +69,6 @@ NOTE: If you are using custom Sidekiq views path, then you will need to call
|
|
73
69
|
|
74
70
|
This library aims to support and is tested against the following Ruby versions:
|
75
71
|
|
76
|
-
* Ruby 2.7.x
|
77
72
|
* Ruby 3.0.x
|
78
73
|
* Ruby 3.1.x
|
79
74
|
* Ruby 3.2.x
|
@@ -98,6 +93,7 @@ This library aims to support and work with following Sidekiq versions:
|
|
98
93
|
|
99
94
|
* Sidekiq 7.0.x
|
100
95
|
* Sidekiq 7.1.x
|
96
|
+
* Sidekiq 7.2.x
|
101
97
|
|
102
98
|
|
103
99
|
== Development
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "sidekiq"
|
4
|
+
require "sidekiq/fetch"
|
5
|
+
|
6
|
+
module Sidekiq
|
7
|
+
module Pauzer
|
8
|
+
module Patches
|
9
|
+
# Default Sidekiq's BasicFetch infused with Pauzer
|
10
|
+
module BasicFetch
|
11
|
+
private
|
12
|
+
|
13
|
+
def queues_cmd
|
14
|
+
super - Pauzer.paused_queues.map { |name| "queue:#{name}" }
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Sidekiq::BasicFetch.prepend(Sidekiq::Pauzer::Patches::BasicFetch)
|
@@ -8,10 +8,6 @@ module Sidekiq
|
|
8
8
|
module Patches
|
9
9
|
# @private
|
10
10
|
module Queue
|
11
|
-
def self.apply!
|
12
|
-
Sidekiq::Queue.prepend(self)
|
13
|
-
end
|
14
|
-
|
15
11
|
def paused?
|
16
12
|
Pauzer.paused?(name)
|
17
13
|
end
|
@@ -29,3 +25,5 @@ module Sidekiq
|
|
29
25
|
end
|
30
26
|
end
|
31
27
|
end
|
28
|
+
|
29
|
+
Sidekiq::Queue.prepend(Sidekiq::Pauzer::Patches::Queue)
|
@@ -12,8 +12,7 @@ module Sidekiq
|
|
12
12
|
|
13
13
|
# @param config [Config]
|
14
14
|
def initialize(config)
|
15
|
-
@
|
16
|
-
@names = []
|
15
|
+
@names = Concurrent::Array.new
|
17
16
|
@redis_key = config.redis_key
|
18
17
|
@refresher = initialize_refresher(config.refresh_rate)
|
19
18
|
end
|
@@ -21,7 +20,7 @@ module Sidekiq
|
|
21
20
|
def each(&block)
|
22
21
|
return to_enum __method__ unless block
|
23
22
|
|
24
|
-
@
|
23
|
+
@names.dup.each(&block)
|
25
24
|
|
26
25
|
self
|
27
26
|
end
|
@@ -71,17 +70,15 @@ module Sidekiq
|
|
71
70
|
end
|
72
71
|
|
73
72
|
def refresh
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
conn.sscan(@redis_key).to_a.uniq.each(&:freeze)
|
80
|
-
end
|
81
|
-
|
82
|
-
@names.replace(names)
|
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)
|
83
78
|
end
|
84
79
|
|
80
|
+
@names.replace(names)
|
81
|
+
|
85
82
|
self
|
86
83
|
end
|
87
84
|
end
|
data/lib/sidekiq/pauzer.rb
CHANGED
@@ -4,8 +4,8 @@ require "forwardable"
|
|
4
4
|
require "sidekiq"
|
5
5
|
require "sidekiq/api"
|
6
6
|
|
7
|
-
require_relative "./pauzer/basic_fetch"
|
8
7
|
require_relative "./pauzer/config"
|
8
|
+
require_relative "./pauzer/patches/basic_fetch"
|
9
9
|
require_relative "./pauzer/patches/queue"
|
10
10
|
require_relative "./pauzer/queues"
|
11
11
|
require_relative "./pauzer/version"
|
@@ -135,5 +135,3 @@ module Sidekiq
|
|
135
135
|
config.on(:shutdown) { Pauzer.shutdown }
|
136
136
|
end
|
137
137
|
end
|
138
|
-
|
139
|
-
Sidekiq::Pauzer::Patches::Queue.apply!
|
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
|
+
version: 4.0.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
|
+
date: 2023-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: concurrent-ruby
|
@@ -48,8 +48,8 @@ files:
|
|
48
48
|
- README.adoc
|
49
49
|
- lib/sidekiq-pauzer.rb
|
50
50
|
- lib/sidekiq/pauzer.rb
|
51
|
-
- lib/sidekiq/pauzer/basic_fetch.rb
|
52
51
|
- lib/sidekiq/pauzer/config.rb
|
52
|
+
- lib/sidekiq/pauzer/patches/basic_fetch.rb
|
53
53
|
- lib/sidekiq/pauzer/patches/queue.rb
|
54
54
|
- lib/sidekiq/pauzer/patches/web_action.rb
|
55
55
|
- lib/sidekiq/pauzer/patches/web_application.rb
|
@@ -62,9 +62,9 @@ licenses:
|
|
62
62
|
- MIT
|
63
63
|
metadata:
|
64
64
|
homepage_uri: https://gitlab.com/ixti/sidekiq-pauzer
|
65
|
-
source_code_uri: https://gitlab.com/ixti/sidekiq-pauzer/tree/
|
65
|
+
source_code_uri: https://gitlab.com/ixti/sidekiq-pauzer/tree/v4.0.0
|
66
66
|
bug_tracker_uri: https://gitlab.com/ixti/sidekiq-pauzer/issues
|
67
|
-
changelog_uri: https://gitlab.com/ixti/sidekiq-pauzer/blob/
|
67
|
+
changelog_uri: https://gitlab.com/ixti/sidekiq-pauzer/blob/v4.0.0/CHANGES.md
|
68
68
|
rubygems_mfa_required: 'true'
|
69
69
|
post_install_message:
|
70
70
|
rdoc_options: []
|
@@ -74,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
74
74
|
requirements:
|
75
75
|
- - ">="
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: '
|
77
|
+
version: '3.0'
|
78
78
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - ">="
|
@@ -1,17 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require "sidekiq"
|
4
|
-
require "sidekiq/fetch"
|
5
|
-
|
6
|
-
module Sidekiq
|
7
|
-
module Pauzer
|
8
|
-
# Default Sidekiq's BasicFetch infused with Pauzer
|
9
|
-
class BasicFetch < Sidekiq::BasicFetch
|
10
|
-
private
|
11
|
-
|
12
|
-
def queues_cmd
|
13
|
-
super - Pauzer.paused_queues.map { |name| "queue:#{name}" }
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|