sidekiq-grouping 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/sidekiq/grouping/batch.rb +3 -5
- data/lib/sidekiq/grouping/middleware.rb +4 -3
- data/lib/sidekiq/grouping/version.rb +1 -1
- data/lib/sidekiq/grouping/views/index.erb +1 -0
- data/lib/sidekiq/grouping/web.rb +4 -4
- data/sidekiq-grouping.gemspec +2 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: abbfc33064b0d62493579060635fbdd8449ab118
|
4
|
+
data.tar.gz: 62f8fb16d37730fb087c78e2ea9ecc9a45d9a42a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f82b31c45dedc4dd5f9c4b73ff4269c78f1ac7e3c564b4064a09575db15eff8dbf938003061f27836a0528945a62b820b6859f230e4b38882a824f63a005ea39
|
7
|
+
data.tar.gz: c30f8345b87e05185f23e26febc766a3b0c857e0a905131dc9586935f8678108ebd3a569e5c5f8168ef225288a2c4834c2d86ca6a21ebd6b387f3eb8ed93ec86
|
data/README.md
CHANGED
@@ -31,7 +31,7 @@ module Sidekiq
|
|
31
31
|
|
32
32
|
def pluck_size
|
33
33
|
worker_class_options['batch_flush_size'] ||
|
34
|
-
|
34
|
+
chunk_size
|
35
35
|
end
|
36
36
|
|
37
37
|
def pluck
|
@@ -87,9 +87,7 @@ module Sidekiq
|
|
87
87
|
private
|
88
88
|
|
89
89
|
def could_flush_on_overflow?
|
90
|
-
|
91
|
-
worker_class_options['batch_flush_size'] &&
|
92
|
-
size >= worker_class_options['batch_flush_size']
|
90
|
+
size >= pluck_size
|
93
91
|
end
|
94
92
|
|
95
93
|
def could_flush_on_time?
|
@@ -125,7 +123,7 @@ module Sidekiq
|
|
125
123
|
|
126
124
|
def extract_worker_klass_and_queue(name)
|
127
125
|
klass, queue = name.split(':')
|
128
|
-
[klass.
|
126
|
+
[klass.camelize, queue]
|
129
127
|
end
|
130
128
|
end
|
131
129
|
end
|
@@ -2,12 +2,13 @@ module Sidekiq
|
|
2
2
|
module Grouping
|
3
3
|
class Middleware
|
4
4
|
def call(worker_class, msg, queue, redis_pool = nil)
|
5
|
-
worker_class = worker_class.
|
5
|
+
worker_class = worker_class.camelize.constantize if worker_class.is_a?(String)
|
6
6
|
options = worker_class.get_sidekiq_options
|
7
7
|
|
8
8
|
batch =
|
9
|
-
options.
|
10
|
-
options.
|
9
|
+
options.key?('batch_flush_size') ||
|
10
|
+
options.key?('batch_flush_interval') ||
|
11
|
+
options.key?('batch_size')
|
11
12
|
|
12
13
|
passthrough =
|
13
14
|
msg['args'] &&
|
@@ -26,6 +26,7 @@
|
|
26
26
|
<td><%= batch.next_execution_time || "–"%></td>
|
27
27
|
<td>
|
28
28
|
<form action="<%= "#{root_path}grouping/#{batch.name}/delete" %>" method="post">
|
29
|
+
<%= csrf_tag %>
|
29
30
|
<input class="btn btn-danger btn-xs" type="submit" name="delete" value="Delete" data-confirm="Are you sure you want to delete this batch?" />
|
30
31
|
</form>
|
31
32
|
</td>
|
data/lib/sidekiq/grouping/web.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'sidekiq/web'
|
2
2
|
|
3
|
-
module
|
3
|
+
module Sidekiq
|
4
4
|
module Grouping
|
5
5
|
module Web
|
6
6
|
VIEWS = File.expand_path('views', File.dirname(__FILE__))
|
@@ -11,8 +11,8 @@ module Sidetiq
|
|
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(
|
14
|
+
app.post "/grouping/*/delete" do |name|
|
15
|
+
worker_class, queue = Sidekiq::Grouping::Batch.extract_worker_klass_and_queue(name)
|
16
16
|
batch = Sidekiq::Grouping::Batch.new(worker_class, queue)
|
17
17
|
batch.delete
|
18
18
|
redirect "#{root_path}/grouping"
|
@@ -23,6 +23,6 @@ module Sidetiq
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
Sidekiq::Web.register(
|
26
|
+
Sidekiq::Web.register(Sidekiq::Grouping::Web)
|
27
27
|
Sidekiq::Web.tabs["Grouping"] = "grouping"
|
28
28
|
|
data/sidekiq-grouping.gemspec
CHANGED
@@ -23,9 +23,9 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_development_dependency "rspec"
|
24
24
|
spec.add_development_dependency "simplecov"
|
25
25
|
spec.add_development_dependency "rspec-sidekiq"
|
26
|
-
spec.add_development_dependency "activesupport"
|
27
26
|
spec.add_development_dependency "timecop"
|
28
27
|
|
29
|
-
spec.add_dependency "
|
28
|
+
spec.add_dependency "activesupport"
|
29
|
+
spec.add_dependency "sidekiq", ">= 3.4.2"
|
30
30
|
spec.add_dependency "concurrent-ruby"
|
31
31
|
end
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Sokolov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: timecop
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
@@ -95,13 +95,13 @@ dependencies:
|
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: activesupport
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
|
-
type: :
|
104
|
+
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 3.4.2
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 3.4.2
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: concurrent-ruby
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|