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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f94eff68244b47c306bb65f6e23aab55491bf744
4
- data.tar.gz: 996ecb43b8622009df48d518a1565ef312d5b55e
3
+ metadata.gz: 7e311f1a16ab9d0a92266f1f41f736bdcd61a7ed
4
+ data.tar.gz: ac06f9b3ed75868dd4cdf54b0e0d6942ad4198d6
5
5
  SHA512:
6
- metadata.gz: 81dccfa7bf862d8630440122861e8f92c48933bf68ed0a4bc7bfeb90ec5234efd778e19de1bf41944b10cba548a33949e2de3e6ec350784f5d515e95ca4d3ce3
7
- data.tar.gz: 4795e8f3247c70759bcc1a8657b5c9384d3a61b16b23ea49d30a03ff73ef9edeef4ed58881f9f66c5c0c767711a6218760e5661ee3cdaea8f5ac1293458557b0
6
+ metadata.gz: 2abff2aa545368106cb0a119af7fcd18ae27670a0b8b48c1444c9e62df9a2f1e25aef40d276fb22d42c810ceda030b5960360448f197e0270acdb89654c5aedc
7
+ data.tar.gz: 7ad097a70621f4f1ad4f1bc7967b61850d30b110b1256bb10e1075d48a48d95c74b56f6a938cb5d5271557e9fbc9d30f52d53d1256e66fc15d038d57dbe52a5f
@@ -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 { @items.push(*items) }
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 ossible.
69
+ # Dequeue as many items as possible.
70
70
  #
71
71
  # @return [ThrottledQueue]
72
72
  def scheduled_dequeue
73
- until @credits < 1 || @items.empty? || @popq.empty?
74
- @credits -= 1
75
- @popq.shift.call @items.shift
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
@@ -15,6 +15,6 @@ module EventMachine
15
15
  class ThrottledQueue < Queue
16
16
  # Gem version, following Semantic Versioning since v1.0.2
17
17
  # @see http://semver.org/
18
- VERSION = [1, 1, 1].join('.')
18
+ VERSION = [1, 1, 2].join('.')
19
19
  end
20
20
  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.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: 2014-04-21 00:00:00.000000000 Z
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.2.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: