sidekiq-limit_fetch 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -2
- data/lib/sidekiq/extensions/queue.rb +1 -1
- data/lib/sidekiq/limit_fetch/global/semaphore.rb +4 -0
- data/sidekiq-limit_fetch.gemspec +1 -1
- data/spec/sidekiq/limit_fetch/global/monitor_spec.rb +2 -1
- data/spec/sidekiq/limit_fetch/semaphore_spec.rb +10 -0
- 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: af4e92376eea915d5ecb40d3d7183859062bf21c
|
4
|
+
data.tar.gz: d596ab1071c952a68eb029a42c3cc4040be33f23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4994be60172a5e21930553db313433ef721c2082fcde29dab9a3b38f9241a0c3da94f216b1e36ebac34c880988100c37394d4b420dac651824d63dbde5ec42a3
|
7
|
+
data.tar.gz: a46416a2481d50e3aa67ec45000ad66c4777f35a36e9d9d6ee1b57228eda0bc4599ec7da73594eda64095431c37da402b4384193b90577ef1ccd27bd3aa02231
|
data/README.md
CHANGED
@@ -79,6 +79,7 @@ will be preserved.
|
|
79
79
|
Sidekiq::Queue['name'].pause # prevents workers from running tasks from this queue
|
80
80
|
Sidekiq::Queue['name'].paused? # => true
|
81
81
|
Sidekiq::Queue['name'].unpause # allows workers to use the queue
|
82
|
+
Sidekiq::Queue['name'].pause_for_ms(1000) # will pause for a second
|
82
83
|
```
|
83
84
|
|
84
85
|
### Blocking queue mode
|
@@ -148,5 +149,6 @@ Dynamic queues will be ran at the lowest priority.
|
|
148
149
|
|
149
150
|
### Thanks
|
150
151
|
|
151
|
-
|
152
|
-
|
152
|
+
<a href="https://evilmartians.com/?utm_source=sidekiq-limit_fetch">
|
153
|
+
<img src="https://evilmartians.com/badges/sponsored-by-evil-martians.svg" alt="Sponsored by Evil Martians" width="236" height="54"></a>
|
154
|
+
|
@@ -76,6 +76,10 @@ module Sidekiq::LimitFetch::Global
|
|
76
76
|
redis {|it| it.set "#{PREFIX}:pause:#@name", true }
|
77
77
|
end
|
78
78
|
|
79
|
+
def pause_for_ms ms
|
80
|
+
redis {|it| it.psetex "#{PREFIX}:pause:#@name", ms, true }
|
81
|
+
end
|
82
|
+
|
79
83
|
def unpause
|
80
84
|
redis {|it| it.del "#{PREFIX}:pause:#@name" }
|
81
85
|
end
|
data/sidekiq-limit_fetch.gemspec
CHANGED
@@ -3,7 +3,8 @@ require 'spec_helper'
|
|
3
3
|
Thread.abort_on_exception = true
|
4
4
|
|
5
5
|
describe Sidekiq::LimitFetch::Global::Monitor do
|
6
|
-
let(:
|
6
|
+
let(:queues) { double dynamic?: false }
|
7
|
+
let(:monitor) { described_class.start! queues, ttl, timeout }
|
7
8
|
let(:ttl) { 1 }
|
8
9
|
let(:queue) { Sidekiq::Queue[name] }
|
9
10
|
let(:name) { 'default' }
|
@@ -52,4 +52,14 @@ describe 'semaphore' do
|
|
52
52
|
2.times { subject.acquire }
|
53
53
|
subject.probed.should == 2
|
54
54
|
end
|
55
|
+
|
56
|
+
it 'should pause tasks for a limited time' do
|
57
|
+
3.times { subject.acquire }
|
58
|
+
subject.pause_for_ms 50
|
59
|
+
2.times { subject.acquire }
|
60
|
+
subject.probed.should == 3
|
61
|
+
sleep(100.0 / 1000)
|
62
|
+
2.times { subject.acquire }
|
63
|
+
subject.probed.should == 5
|
64
|
+
end
|
55
65
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sidekiq-limit_fetch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- brainopia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sidekiq
|
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
122
|
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.4.
|
125
|
+
rubygems_version: 2.4.5
|
126
126
|
signing_key:
|
127
127
|
specification_version: 4
|
128
128
|
summary: Sidekiq strategy to support queue limits
|