em-throttled_queue 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/em/throttled_queue.rb +11 -5
- data/lib/em/throttled_queue/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e311f1a16ab9d0a92266f1f41f736bdcd61a7ed
|
4
|
+
data.tar.gz: ac06f9b3ed75868dd4cdf54b0e0d6942ad4198d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2abff2aa545368106cb0a119af7fcd18ae27670a0b8b48c1444c9e62df9a2f1e25aef40d276fb22d42c810ceda030b5960360448f197e0270acdb89654c5aedc
|
7
|
+
data.tar.gz: 7ad097a70621f4f1ad4f1bc7967b61850d30b110b1256bb10e1075d48a48d95c74b56f6a938cb5d5271557e9fbc9d30f52d53d1256e66fc15d038d57dbe52a5f
|
data/lib/em/throttled_queue.rb
CHANGED
@@ -49,7 +49,7 @@ module EventMachine
|
|
49
49
|
# @param [item, …] items items to be pushed onto the queue
|
50
50
|
# @return (see #interact)
|
51
51
|
def push(*items)
|
52
|
-
interact { @
|
52
|
+
interact { @sink.push(*items) }
|
53
53
|
end
|
54
54
|
|
55
55
|
private
|
@@ -66,13 +66,19 @@ module EventMachine
|
|
66
66
|
self
|
67
67
|
end
|
68
68
|
|
69
|
-
# Dequeue as many items as
|
69
|
+
# Dequeue as many items as possible.
|
70
70
|
#
|
71
71
|
# @return [ThrottledQueue]
|
72
72
|
def scheduled_dequeue
|
73
|
-
|
74
|
-
@
|
75
|
-
|
73
|
+
unless @popq.empty?
|
74
|
+
if @drain.empty?
|
75
|
+
@drain = @sink
|
76
|
+
@sink = []
|
77
|
+
end
|
78
|
+
until @credits < 1 || @drain.empty? || @popq.empty?
|
79
|
+
@credits -= 1
|
80
|
+
@popq.shift.call @drain.shift
|
81
|
+
end
|
76
82
|
end
|
77
83
|
self
|
78
84
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: em-throttled_queue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kim Burgestrand
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eventmachine
|
@@ -119,10 +119,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
requirements: []
|
121
121
|
rubyforge_project:
|
122
|
-
rubygems_version: 2.
|
122
|
+
rubygems_version: 2.5.1
|
123
123
|
signing_key:
|
124
124
|
specification_version: 4
|
125
125
|
summary: A rate-limited Queue for EventMachine
|
126
126
|
test_files:
|
127
127
|
- spec/throttled_queue.rb
|
128
|
-
has_rdoc:
|