sidekiq-throttled 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +5 -3
- data/.travis.yml +23 -2
- data/CHANGES.md +14 -0
- data/Gemfile +11 -0
- data/README.md +42 -1
- data/Rakefile +1 -0
- data/bin/setup +1 -2
- data/lib/sidekiq/throttled.rb +2 -1
- data/lib/sidekiq/throttled/basic_fetch.rb +6 -5
- data/lib/sidekiq/throttled/errors.rb +1 -0
- data/lib/sidekiq/throttled/middleware.rb +2 -1
- data/lib/sidekiq/throttled/registry.rb +17 -1
- data/lib/sidekiq/throttled/strategy.rb +27 -12
- data/lib/sidekiq/throttled/strategy/concurrency.rb +29 -14
- data/lib/sidekiq/throttled/strategy/script.rb +1 -0
- data/lib/sidekiq/throttled/strategy/threshold.rb +23 -10
- data/lib/sidekiq/throttled/testing.rb +1 -0
- data/lib/sidekiq/throttled/version.rb +2 -1
- data/lib/sidekiq/throttled/web.rb +1 -0
- data/lib/sidekiq/throttled/web/index.html.erb +1 -1
- data/lib/sidekiq/throttled/web/stats.rb +4 -0
- data/lib/sidekiq/throttled/worker.rb +1 -0
- data/sidekiq-throttled.gemspec +4 -7
- metadata +4 -80
- data/bin/console +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d035a47cfda4397f044828ef34ce2adfba25f4a
|
4
|
+
data.tar.gz: d41409aa677dd84626738d1f3860d39acd951d72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f313f44d9f897fffc7bb1c3e503fdac7f6884bd3733eab89ede741a208b071207d7c7e09854fa631a00a0fde7308a6ba1753f8953211c66a55b3d53bfdac6342
|
7
|
+
data.tar.gz: 01f919a66399826c5e67f05b44e86d5440e5e63b6565b5cada2980a12d24f27e296d8d10f76ec4cd1d575e927d84666afa22066eb69d7c49d76374b3cd59cae8
|
data/.rubocop.yml
CHANGED
@@ -18,6 +18,9 @@ Style/EmptyLineBetweenDefs:
|
|
18
18
|
Style/Encoding:
|
19
19
|
EnforcedStyle: when_needed
|
20
20
|
|
21
|
+
Style/FrozenStringLiteralComment:
|
22
|
+
EnforcedStyle: always
|
23
|
+
|
21
24
|
Style/HashSyntax:
|
22
25
|
EnforcedStyle: hash_rockets
|
23
26
|
|
@@ -34,8 +37,7 @@ Style/MultilineOperationIndentation:
|
|
34
37
|
# IMHO `%r{foo/bar}` looks way more cleaner than `/foo\/bar/`.
|
35
38
|
# Enabling this cop also makes Guardfile (which is full of pathname regexps)
|
36
39
|
# look absolutley (style) inconsistent and terrible. Thus it should be on
|
37
|
-
# developer's choice whenever to user `%r` or not.
|
38
|
-
# to use `["foo"]` over `%w(foo)` and so on.
|
40
|
+
# developer's choice whenever to user `%r` or not.
|
39
41
|
Style/RegexpLiteral:
|
40
42
|
Enabled: false
|
41
43
|
|
@@ -45,7 +47,7 @@ Style/RegexpLiteral:
|
|
45
47
|
# conn.hset :k1, now
|
46
48
|
# conn.hincrby :k2, 123
|
47
49
|
# end
|
48
|
-
Style/
|
50
|
+
Style/SpaceBeforeFirstArg:
|
49
51
|
Enabled: false
|
50
52
|
|
51
53
|
Style/StringLiterals:
|
data/.travis.yml
CHANGED
@@ -1,4 +1,25 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
4
|
-
|
3
|
+
- 2.0
|
4
|
+
- 2.1
|
5
|
+
- 2.2
|
6
|
+
- 2.3.0
|
7
|
+
- ruby-head
|
8
|
+
- jruby-9.0.0.0
|
9
|
+
- jruby-9.0.1.0
|
10
|
+
- jruby-head
|
11
|
+
- ruby-head
|
12
|
+
- rbx-2
|
13
|
+
matrix:
|
14
|
+
allow_failures:
|
15
|
+
- rvm: jruby-9.0.0.0
|
16
|
+
- rvm: jruby-9.0.1.0
|
17
|
+
- rvm: jruby-head
|
18
|
+
- rvm: ruby-head
|
19
|
+
- rvm: rbx-2
|
20
|
+
fast_finish: true
|
21
|
+
before_install:
|
22
|
+
- gem install bundler -v 1.10.6
|
23
|
+
services:
|
24
|
+
- redis-server
|
25
|
+
sudo: false
|
data/CHANGES.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
## 0.2.0 (2016-02-29)
|
2
|
+
|
3
|
+
* [#6](https://github.com/sensortower/sidekiq-throttled/pull/6):
|
4
|
+
Add dynamic key suffix functionality.
|
5
|
+
([@fhwang])
|
6
|
+
|
7
|
+
|
8
|
+
## 0.1.0 (2015-11-03)
|
9
|
+
|
10
|
+
* Initial release.
|
11
|
+
|
12
|
+
|
13
|
+
[@ixti]: https://github.com/ixti
|
14
|
+
[@fhwang]: https://github.com/fhwang
|
data/Gemfile
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
source "https://rubygems.org"
|
2
3
|
|
4
|
+
group :test do
|
5
|
+
gem "coveralls"
|
6
|
+
gem "rack-test"
|
7
|
+
gem "rspec"
|
8
|
+
gem "rubocop"
|
9
|
+
gem "simplecov", ">= 0.9"
|
10
|
+
gem "sinatra", "~> 1.4", ">= 1.4.6"
|
11
|
+
gem "timecop"
|
12
|
+
end
|
13
|
+
|
3
14
|
# Specify your gem's dependencies in sidekiq-throttled.gemspec
|
4
15
|
gemspec
|
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# Sidekiq::Throttled
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/sidekiq-throttled.svg)](http://rubygems.org/gems/sidekiq-throttled)
|
4
|
+
[![Build Status](https://travis-ci.org/sensortower/sidekiq-throttled.svg?branch=master)](https://travis-ci.org/sensortower/sidekiq-throttled)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/sensortower/sidekiq-throttled.svg?branch=master)](https://codeclimate.com/github/sensortower/sidekiq-throttled)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/sensortower/sidekiq-throttled/badge.svg?branch=master&service=github)](https://coveralls.io/github/sensortower/sidekiq-throttled?branch=master)
|
7
|
+
|
8
|
+
Concurrency and threshold throttling for [Sidekiq](https://github.com/mperham/sidekiq/).
|
4
9
|
|
5
10
|
|
6
11
|
## Installation
|
@@ -58,6 +63,42 @@ end
|
|
58
63
|
```
|
59
64
|
|
60
65
|
|
66
|
+
### Dynamic throttling
|
67
|
+
|
68
|
+
You can throttle jobs dynamically with `:key_suffix` option:
|
69
|
+
|
70
|
+
``` ruby
|
71
|
+
class MyWorker
|
72
|
+
include Sidekiq::Worker
|
73
|
+
include Sidekiq::Throttled::Worker
|
74
|
+
|
75
|
+
sidekiq_options :queue => :my_queue
|
76
|
+
|
77
|
+
sidekiq_throttle({
|
78
|
+
# Allow maximum 10 concurrent jobs per user at a time.
|
79
|
+
:concurrency => { :limit => 10, :key_suffix => -> (user_id) { user_id } }
|
80
|
+
})
|
81
|
+
|
82
|
+
def perform(user_id)
|
83
|
+
# ...
|
84
|
+
end
|
85
|
+
end
|
86
|
+
```
|
87
|
+
|
88
|
+
|
89
|
+
## Supported Ruby Versions
|
90
|
+
|
91
|
+
This library aims to support and is [tested against][travis] the following Ruby
|
92
|
+
versions:
|
93
|
+
|
94
|
+
* Ruby 2.0.0
|
95
|
+
* Ruby 2.1.x
|
96
|
+
* Ruby 2.2.x
|
97
|
+
* Ruby 2.3.0
|
98
|
+
|
99
|
+
[travis]: http://travis-ci.org/sensortower/sidekiq-throttled
|
100
|
+
|
101
|
+
|
61
102
|
## Contributing
|
62
103
|
|
63
104
|
* Fork sidekiq-throttled on GitHub
|
data/Rakefile
CHANGED
data/bin/setup
CHANGED
data/lib/sidekiq/throttled.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# 3rd party
|
2
3
|
require "sidekiq"
|
3
4
|
|
@@ -60,7 +61,7 @@ module Sidekiq
|
|
60
61
|
jid = message.fetch("jid".freeze) { return false }
|
61
62
|
|
62
63
|
Registry.get job do |strategy|
|
63
|
-
return strategy.throttled?
|
64
|
+
return strategy.throttled?(jid, *message["args"])
|
64
65
|
end
|
65
66
|
|
66
67
|
false
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# stdlib
|
2
3
|
require "thread"
|
3
4
|
|
@@ -39,11 +40,11 @@ module Sidekiq
|
|
39
40
|
# Tries to pop pair of `queue` and job `message` out of sidekiq queue.
|
40
41
|
# @return [Array<String, String>, nil]
|
41
42
|
def brpop
|
42
|
-
if @strictly_ordered_queues
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
queues = if @strictly_ordered_queues
|
44
|
+
@unique_queues.dup
|
45
|
+
else
|
46
|
+
@queues.shuffle.uniq
|
47
|
+
end
|
47
48
|
|
48
49
|
@mutex.synchronize do
|
49
50
|
next if @suspended.empty?
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# internal
|
2
3
|
require "sidekiq/throttled/registry"
|
3
4
|
|
@@ -11,7 +12,7 @@ module Sidekiq
|
|
11
12
|
yield
|
12
13
|
ensure
|
13
14
|
Registry.get msg["class".freeze] do |strategy|
|
14
|
-
strategy.finalize!
|
15
|
+
strategy.finalize!(msg["jid".freeze], *msg["args"])
|
15
16
|
end
|
16
17
|
end
|
17
18
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# internal
|
2
3
|
require "sidekiq/throttled/strategy"
|
3
4
|
|
@@ -34,7 +35,7 @@ module Sidekiq
|
|
34
35
|
old_name = old_name.to_s
|
35
36
|
|
36
37
|
warn "Duplicate strategy name: #{new_name}" if @strategies[new_name]
|
37
|
-
|
38
|
+
raise "Strategy not found: #{old_name}" unless @strategies[old_name]
|
38
39
|
|
39
40
|
@aliases[new_name] = @strategies[old_name]
|
40
41
|
end
|
@@ -67,6 +68,21 @@ module Sidekiq
|
|
67
68
|
@strategies.each { |*args| yield(*args) }
|
68
69
|
self
|
69
70
|
end
|
71
|
+
|
72
|
+
# @overload each_with_static_keys()
|
73
|
+
# @return [Enumerator]
|
74
|
+
#
|
75
|
+
# @overload each_with_static_keys(&block)
|
76
|
+
# @yieldparam [String] name
|
77
|
+
# @yieldparam [Strategy] strategy
|
78
|
+
# @yield [strategy] Gives strategy to the block
|
79
|
+
# @return [Registry]
|
80
|
+
def each_with_static_keys
|
81
|
+
return to_enum(__method__) unless block_given?
|
82
|
+
@strategies.each do |name, strategy|
|
83
|
+
yield(name, strategy) unless strategy.dynamic_keys?
|
84
|
+
end
|
85
|
+
end
|
70
86
|
end
|
71
87
|
end
|
72
88
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# internal
|
2
3
|
require "sidekiq/throttled/errors"
|
3
4
|
require "sidekiq/throttled/strategy/concurrency"
|
@@ -15,28 +16,42 @@ module Sidekiq
|
|
15
16
|
# @return [Strategy::Threshold, nil]
|
16
17
|
attr_reader :threshold
|
17
18
|
|
18
|
-
# @param [#to_s]
|
19
|
+
# @param [#to_s] name
|
19
20
|
# @param [Hash] concurrency Concurrency options.
|
20
21
|
# See {Strategy::Concurrency#initialize} for details.
|
21
22
|
# @param [Hash] threshold Threshold options.
|
22
23
|
# See {Strategy::Threshold#initialize} for details.
|
23
|
-
|
24
|
-
|
24
|
+
# @param [Hash] key_suffix Proc for dynamic keys.
|
25
|
+
def initialize(name, concurrency: nil, threshold: nil, key_suffix: nil)
|
26
|
+
key = "throttled:#{name}"
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
+
if concurrency
|
29
|
+
@concurrency = Concurrency.new(
|
30
|
+
key, concurrency.merge(:key_suffix => key_suffix)
|
31
|
+
)
|
32
|
+
end
|
33
|
+
if threshold
|
34
|
+
@threshold = Threshold.new(
|
35
|
+
key, threshold.merge(:key_suffix => key_suffix)
|
36
|
+
)
|
37
|
+
end
|
28
38
|
|
29
39
|
return if @concurrency || @threshold
|
30
40
|
|
31
|
-
|
41
|
+
raise ArgumentError, "Neither :concurrency nor :threshold given"
|
42
|
+
end
|
43
|
+
|
44
|
+
def dynamic_keys?
|
45
|
+
(@concurrency && @concurrency.dynamic_keys?) ||
|
46
|
+
(@threshold && @threshold.dynamic_keys?)
|
32
47
|
end
|
33
48
|
|
34
49
|
# @return [Boolean] whenever job is throttled or not.
|
35
|
-
def throttled?(jid)
|
36
|
-
return true if @concurrency && @concurrency.throttled?(jid)
|
50
|
+
def throttled?(jid, *job_args)
|
51
|
+
return true if @concurrency && @concurrency.throttled?(jid, *job_args)
|
37
52
|
|
38
|
-
if @threshold && @threshold.throttled?
|
39
|
-
finalize!
|
53
|
+
if @threshold && @threshold.throttled?(*job_args)
|
54
|
+
finalize!(jid, *job_args)
|
40
55
|
return true
|
41
56
|
end
|
42
57
|
|
@@ -45,8 +60,8 @@ module Sidekiq
|
|
45
60
|
|
46
61
|
# Marks job as being processed.
|
47
62
|
# @return [void]
|
48
|
-
def finalize!(jid)
|
49
|
-
@concurrency && @concurrency.finalize!(jid)
|
63
|
+
def finalize!(jid, *job_args)
|
64
|
+
@concurrency && @concurrency.finalize!(jid, *job_args)
|
50
65
|
end
|
51
66
|
|
52
67
|
# Resets count of jobs of all avaliable strategies
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# internal
|
2
3
|
require "sidekiq/throttled/strategy/script"
|
3
4
|
|
@@ -20,38 +21,52 @@ module Sidekiq
|
|
20
21
|
# @return [Integer] Amount of allwoed concurrent job processors
|
21
22
|
attr_reader :limit
|
22
23
|
|
23
|
-
# @param [#to_s]
|
24
|
+
# @param [#to_s] strategy_key
|
24
25
|
# @param [Hash] opts
|
25
26
|
# @option opts [#to_i] :limit Amount of allwoed concurrent jobs
|
26
27
|
# processors running for given key
|
27
|
-
# @option opts [#to_i] :ttl (15
|
28
|
-
|
29
|
-
|
30
|
-
|
28
|
+
# @option opts [#to_i] :ttl (15 minutes) Concurrency lock TTL
|
29
|
+
# in seconds
|
30
|
+
# @option opts :key_suffix Proc for dynamic key suffix.
|
31
|
+
def initialize(strategy_key, opts)
|
32
|
+
@base_key = "#{strategy_key}:concurrency".freeze
|
31
33
|
@limit = opts.fetch(:limit).to_i
|
32
|
-
@ttl
|
34
|
+
@ttl = opts.fetch(:ttl, 900).to_i
|
35
|
+
@key_suffix = opts[:key_suffix]
|
36
|
+
end
|
37
|
+
|
38
|
+
def dynamic_keys?
|
39
|
+
@key_suffix
|
33
40
|
end
|
34
41
|
|
35
42
|
# @return [Boolean] whenever job is throttled or not
|
36
|
-
def throttled?(jid)
|
37
|
-
1 == SCRIPT.eval(
|
43
|
+
def throttled?(jid, *job_args)
|
44
|
+
1 == SCRIPT.eval([key(job_args)], [@limit, @ttl, jid.to_s])
|
38
45
|
end
|
39
46
|
|
40
47
|
# @return [Integer] Current count of jobs
|
41
|
-
def count
|
42
|
-
Sidekiq.redis { |conn| conn.scard(
|
48
|
+
def count(*job_args)
|
49
|
+
Sidekiq.redis { |conn| conn.scard(key(job_args)) }.to_i
|
43
50
|
end
|
44
51
|
|
45
52
|
# Resets count of jobs
|
46
53
|
# @return [void]
|
47
|
-
def reset!
|
48
|
-
Sidekiq.redis { |conn| conn.del(
|
54
|
+
def reset!(*job_args)
|
55
|
+
Sidekiq.redis { |conn| conn.del(key(job_args)) }.to_i
|
49
56
|
end
|
50
57
|
|
51
58
|
# Remove jid from the pool of jobs in progress
|
52
59
|
# @return [void]
|
53
|
-
def finalize!(jid)
|
54
|
-
Sidekiq.redis { |conn| conn.srem(
|
60
|
+
def finalize!(jid, *job_args)
|
61
|
+
Sidekiq.redis { |conn| conn.srem(key(job_args), jid.to_s) }
|
62
|
+
end
|
63
|
+
|
64
|
+
private
|
65
|
+
|
66
|
+
def key(job_args)
|
67
|
+
key = @base_key.dup
|
68
|
+
key << ":#{@key_suffix.call(*job_args)}" if @key_suffix
|
69
|
+
key
|
55
70
|
end
|
56
71
|
end
|
57
72
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
# internal
|
2
3
|
require "sidekiq/throttled/strategy/script"
|
3
4
|
|
@@ -36,31 +37,43 @@ module Sidekiq
|
|
36
37
|
# @return [Float] Period in seconds
|
37
38
|
attr_reader :period
|
38
39
|
|
39
|
-
# @param [#to_s]
|
40
|
+
# @param [#to_s] strategy_key
|
40
41
|
# @param [Hash] opts
|
41
42
|
# @option opts [#to_i] :limit Amount of jobs allowed per period
|
42
43
|
# @option opts [#to_f] :period Period in seconds
|
43
|
-
def initialize(
|
44
|
-
@
|
45
|
-
@keys = [@key]
|
44
|
+
def initialize(strategy_key, opts)
|
45
|
+
@base_key = "#{strategy_key}:threshold".freeze
|
46
46
|
@limit = opts.fetch(:limit).to_i
|
47
47
|
@period = opts.fetch(:period).to_f
|
48
|
+
@key_suffix = opts[:key_suffix]
|
49
|
+
end
|
50
|
+
|
51
|
+
def dynamic_keys?
|
52
|
+
@key_suffix
|
48
53
|
end
|
49
54
|
|
50
55
|
# @return [Boolean] whenever job is throttled or not
|
51
|
-
def throttled?
|
52
|
-
1 == SCRIPT.eval(
|
56
|
+
def throttled?(*job_args)
|
57
|
+
1 == SCRIPT.eval([key(job_args)], [@limit, @period, Time.now.to_f])
|
53
58
|
end
|
54
59
|
|
55
60
|
# @return [Integer] Current count of jobs
|
56
|
-
def count
|
57
|
-
Sidekiq.redis { |conn| conn.llen(
|
61
|
+
def count(*job_args)
|
62
|
+
Sidekiq.redis { |conn| conn.llen(key(job_args)) }.to_i
|
58
63
|
end
|
59
64
|
|
60
65
|
# Resets count of jobs
|
61
66
|
# @return [void]
|
62
|
-
def reset!
|
63
|
-
Sidekiq.redis { |conn| conn.del(
|
67
|
+
def reset!(*job_args)
|
68
|
+
Sidekiq.redis { |conn| conn.del(key(job_args)) }
|
69
|
+
end
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def key(job_args)
|
74
|
+
key = @base_key.dup
|
75
|
+
key << ":#{@key_suffix.call(*job_args)}" if @key_suffix
|
76
|
+
key
|
64
77
|
end
|
65
78
|
end
|
66
79
|
end
|
@@ -16,7 +16,7 @@
|
|
16
16
|
</tr>
|
17
17
|
</thead>
|
18
18
|
<tbody>
|
19
|
-
<% Sidekiq::Throttled::Registry.
|
19
|
+
<% Sidekiq::Throttled::Registry.each_with_static_keys do |name, strategy| %>
|
20
20
|
<tr>
|
21
21
|
<td style="vertical-align:middle;"><%= name %></td>
|
22
22
|
<td style="vertical-align:middle;text-align:center;">
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
module Sidekiq
|
2
3
|
module Throttled
|
3
4
|
module Web
|
@@ -13,6 +14,9 @@ module Sidekiq
|
|
13
14
|
|
14
15
|
# @param [Strategy::Concurrency, Strategy::Threshold] strategy
|
15
16
|
def initialize(strategy)
|
17
|
+
if strategy && strategy.dynamic_keys?
|
18
|
+
raise ArgumentError, "Can't handle strategies with dynamic keys"
|
19
|
+
end
|
16
20
|
@strategy = strategy
|
17
21
|
end
|
18
22
|
|
data/sidekiq-throttled.gemspec
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# coding: utf-8
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
lib = File.expand_path("../lib", __FILE__)
|
4
5
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
@@ -16,8 +17,9 @@ Gem::Specification.new do |spec|
|
|
16
17
|
spec.homepage = "https://github.com/sensortower/sidekiq-throttled"
|
17
18
|
spec.license = "MIT"
|
18
19
|
|
19
|
-
spec.files = `git ls-files -z`.split("\x0")
|
20
|
-
|
20
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
21
|
+
f.match %r{^(test|spec|features)/}
|
22
|
+
end
|
21
23
|
|
22
24
|
spec.bindir = "exe"
|
23
25
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
@@ -27,9 +29,4 @@ Gem::Specification.new do |spec|
|
|
27
29
|
|
28
30
|
spec.add_development_dependency "bundler", "~> 1.10"
|
29
31
|
spec.add_development_dependency "rake", "~> 10.0"
|
30
|
-
spec.add_development_dependency "rspec"
|
31
|
-
spec.add_development_dependency "timecop"
|
32
|
-
spec.add_development_dependency "rubocop"
|
33
|
-
spec.add_development_dependency "rack-test"
|
34
|
-
spec.add_development_dependency "sinatra", "~> 1.4", ">= 1.4.6"
|
35
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-throttled
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexey V Zapparov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -52,82 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: timecop
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: rubocop
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: rack-test
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :development
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
- !ruby/object:Gem::Dependency
|
112
|
-
name: sinatra
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - "~>"
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '1.4'
|
118
|
-
- - ">="
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
version: 1.4.6
|
121
|
-
type: :development
|
122
|
-
prerelease: false
|
123
|
-
version_requirements: !ruby/object:Gem::Requirement
|
124
|
-
requirements:
|
125
|
-
- - "~>"
|
126
|
-
- !ruby/object:Gem::Version
|
127
|
-
version: '1.4'
|
128
|
-
- - ">="
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: 1.4.6
|
131
55
|
description: Concurrency and threshold throttling for Sidekiq.
|
132
56
|
email:
|
133
57
|
- ixti@member.fsf.org
|
@@ -140,11 +64,11 @@ files:
|
|
140
64
|
- ".rubocop.yml"
|
141
65
|
- ".travis.yml"
|
142
66
|
- ".yardopts"
|
67
|
+
- CHANGES.md
|
143
68
|
- Gemfile
|
144
69
|
- LICENSE.md
|
145
70
|
- README.md
|
146
71
|
- Rakefile
|
147
|
-
- bin/console
|
148
72
|
- bin/setup
|
149
73
|
- lib/sidekiq/throttled.rb
|
150
74
|
- lib/sidekiq/throttled/basic_fetch.rb
|
@@ -184,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
108
|
version: '0'
|
185
109
|
requirements: []
|
186
110
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.5.1
|
188
112
|
signing_key:
|
189
113
|
specification_version: 4
|
190
114
|
summary: Concurrency and threshold throttling for Sidekiq.
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "sidekiq/throttled"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|