sidekiq-limit_fetch 1.0 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -20,6 +20,8 @@ Add this line to your application's Gemfile:
20
20
 
21
21
  ## Usage
22
22
 
23
+ ### Limits
24
+
23
25
  Specify limits which you want to place on queues inside sidekiq.yml:
24
26
 
25
27
  ```yaml
@@ -42,6 +44,8 @@ Ability to set limits dynamically allows you to resize worker
42
44
  distribution among queues any time you want.
43
45
 
44
46
 
47
+ ### Pauses
48
+
45
49
  You can also pause your queues temporarely. Upon continuing their limits
46
50
  will be preserved.
47
51
 
@@ -58,6 +62,7 @@ You can see how many workers currently handling a queue:
58
62
  Sidekiq::Queue['name'].busy # number of busy workers
59
63
  ```
60
64
 
65
+ ### Multiple processes
61
66
 
62
67
  Limits are applied per process. In case you have several worker
63
68
  processes and want to have global locks between them, you'll need to
@@ -74,6 +79,8 @@ or
74
79
  ```
75
80
 
76
81
 
82
+ ### Blocking queue mode
83
+
77
84
  If you use strict queue ordering (it will be used if you don't specify queue weights)
78
85
  then you can set blocking status for queues. It means if a blocking
79
86
  queue task is executing then no new task from lesser priority queues will
@@ -100,5 +107,7 @@ You can also enable and disable blocking mode for queues on the fly:
100
107
  ```
101
108
 
102
109
 
110
+ ### Thanks
111
+
103
112
  Sponsored by [Evil Martians].
104
113
  [Evil Martians]: http://evilmartians.com/
@@ -55,7 +55,7 @@ class Sidekiq::LimitFetch
55
55
  end
56
56
 
57
57
  def restore
58
- Thread.current[THREAD_KEY]
58
+ Thread.current[THREAD_KEY] || []
59
59
  ensure
60
60
  Thread.current[THREAD_KEY] = nil
61
61
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'sidekiq-limit_fetch'
3
- gem.version = '1.0'
3
+ gem.version = '1.1'
4
4
  gem.authors = 'brainopia'
5
5
  gem.email = 'brainopia@evilmartians.com'
6
6
  gem.summary = 'Sidekiq strategy to support queue limits'
@@ -54,6 +54,12 @@ describe Sidekiq::LimitFetch::Queues do
54
54
  Sidekiq::Queue['queue2'].busy.should == 0
55
55
  end
56
56
 
57
+ it 'should release when no queues was acquired' do
58
+ queues.each {|name| Sidekiq::Queue[name].pause }
59
+ subject.acquire
60
+ -> { subject.release_except nil }.should_not raise_exception
61
+ end
62
+
57
63
  context 'blocking' do
58
64
  let(:blocking) { %w(queue1) }
59
65
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-limit_fetch
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '1.1'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-25 00:00:00.000000000 Z
12
+ date: 2013-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sidekiq
@@ -109,7 +109,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  segments:
111
111
  - 0
112
- hash: -2462116291235109509
112
+ hash: -3014276428821981336
113
113
  required_rubygems_version: !ruby/object:Gem::Requirement
114
114
  none: false
115
115
  requirements:
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  segments:
120
120
  - 0
121
- hash: -2462116291235109509
121
+ hash: -3014276428821981336
122
122
  requirements: []
123
123
  rubyforge_project:
124
124
  rubygems_version: 1.8.24