sidekiq-grouping 1.0.8 → 1.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -3
- data/lib/sidekiq/grouping/config.rb +13 -6
- data/lib/sidekiq/grouping/version.rb +1 -1
- data/lib/sidekiq/grouping/web.rb +3 -4
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42ade6a2a9e5a211f91f65d138add7f4cbeaeef8
|
4
|
+
data.tar.gz: a230dcc8364303f18e45920294ca9f8c5a5b8895
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ebcd0fa5c6ec5c6b9428836547c8036db3eb8093567f47830790e1bd2d90622085f17fe10d42a2a35e3d08b06520c90e35f45060be37ec60f7c7dd3f89698a9
|
7
|
+
data.tar.gz: 58a8742715f73757ef98f881df956022ee8341f7bbffb2d724eefbbd345866a5ae6433d07dbc354e0ebdd624459228b36ed884ff93c8f4c663841af421eb74d1
|
data/README.md
CHANGED
@@ -123,12 +123,25 @@ require "sidekiq/grouping/web"
|
|
123
123
|
|
124
124
|
## Configuration
|
125
125
|
|
126
|
+
Specify grouping configuration inside of sidekiq.yml:
|
127
|
+
|
128
|
+
```yml
|
129
|
+
grouping:
|
130
|
+
:poll_interval: 5 # Amount of time between polling batches
|
131
|
+
:max_batch_size: 5000 # Maximum batch size allowed
|
132
|
+
:lock_ttl: 1 # Batch queue flush lock timeout job enqueues
|
133
|
+
```
|
134
|
+
|
135
|
+
Or set it in your code:
|
136
|
+
|
126
137
|
```ruby
|
127
|
-
Sidekiq::Grouping::Config.poll_interval = 5
|
128
|
-
Sidekiq::Grouping::Config.max_batch_size = 5000
|
129
|
-
Sidekiq::Grouping::Config.lock_ttl = 1
|
138
|
+
Sidekiq::Grouping::Config.poll_interval = 5
|
139
|
+
Sidekiq::Grouping::Config.max_batch_size = 5000
|
140
|
+
Sidekiq::Grouping::Config.lock_ttl = 1
|
130
141
|
```
|
131
142
|
|
143
|
+
Note that you should set poll_interval option inside of sidekiq.yml to take effect. Setting this param in your ruby code won't change actual polling frequency.
|
144
|
+
|
132
145
|
## TODO
|
133
146
|
|
134
147
|
1. Add support redis_pool option.
|
@@ -1,15 +1,22 @@
|
|
1
1
|
module Sidekiq::Grouping::Config
|
2
2
|
include ActiveSupport::Configurable
|
3
3
|
|
4
|
+
def self.options
|
5
|
+
Sidekiq.options["grouping"] || {}
|
6
|
+
end
|
7
|
+
|
4
8
|
# Queue size overflow check polling interval
|
5
|
-
config_accessor :poll_interval
|
6
|
-
|
9
|
+
config_accessor :poll_interval do
|
10
|
+
options[:poll_interval] || 3
|
11
|
+
end
|
7
12
|
|
8
13
|
# Maximum batch size
|
9
|
-
config_accessor :max_batch_size
|
10
|
-
|
14
|
+
config_accessor :max_batch_size do
|
15
|
+
options[:max_batch_size] || 1000
|
16
|
+
end
|
11
17
|
|
12
18
|
# Batch queue flush lock timeout
|
13
|
-
config_accessor :lock_ttl
|
14
|
-
|
19
|
+
config_accessor :lock_ttl do
|
20
|
+
options[:lock_ttl] || 1
|
21
|
+
end
|
15
22
|
end
|
data/lib/sidekiq/grouping/web.rb
CHANGED
@@ -11,11 +11,11 @@ module Sidekiq
|
|
11
11
|
erb File.read(File.join(VIEWS, 'index.erb')), locals: {view_path: VIEWS}
|
12
12
|
end
|
13
13
|
|
14
|
-
app.post "/grouping
|
15
|
-
worker_class, queue = Sidekiq::Grouping::Batch.extract_worker_klass_and_queue(name)
|
14
|
+
app.post "/grouping/:name/delete" do
|
15
|
+
worker_class, queue = Sidekiq::Grouping::Batch.extract_worker_klass_and_queue(params['name'])
|
16
16
|
batch = Sidekiq::Grouping::Batch.new(worker_class, queue)
|
17
17
|
batch.delete
|
18
|
-
redirect "#{root_path}
|
18
|
+
redirect "#{root_path}grouping"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -25,4 +25,3 @@ end
|
|
25
25
|
|
26
26
|
Sidekiq::Web.register(Sidekiq::Grouping::Web)
|
27
27
|
Sidekiq::Web.tabs["Grouping"] = "grouping"
|
28
|
-
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-grouping
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Sokolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
186
|
version: '0'
|
187
187
|
requirements: []
|
188
188
|
rubyforge_project:
|
189
|
-
rubygems_version: 2.
|
189
|
+
rubygems_version: 2.6.12
|
190
190
|
signing_key:
|
191
191
|
specification_version: 4
|
192
192
|
summary: Allows identical sidekiq jobs to be processed with a single background call
|