em-throttled_queue 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +8 -6
- data/em-throttled_queue.gemspec +3 -2
- data/lib/em-throttled_queue.rb +1 -0
- data/lib/em/throttled_queue/version.rb +1 -1
- data/spec/throttled_queue.rb +2 -2
- metadata +3 -2
data/README.markdown
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
# EM-Throttled_Queue is a throttled queue (surprise, surprise!)
|
2
2
|
[ThrottledQueue](http://rdoc.info/github/Burgestrand/em-throttled_queue/master/EventMachine/ThrottledQueue) is just like an [EM::Queue](http://rdoc.info/github/eventmachine/eventmachine/master/EventMachine/Queue), but will pop items off itself at a pace specified by you!
|
3
3
|
|
4
|
-
Version v1.0.0 and v1.0.1 has an unintentional flaw (result of coding while tired) and should not be used.
|
5
|
-
|
6
|
-
Example
|
7
|
-
-------
|
4
|
+
*NOTE*: Version v1.0.0 and v1.0.1 has an unintentional flaw (result of coding while tired) and should not be used.
|
8
5
|
|
6
|
+
Usage
|
7
|
+
-----
|
8
|
+
require 'em/throttled_queue'
|
9
|
+
|
9
10
|
# Example code that will pop off 2 items in total within a period of
|
10
11
|
# one second. The other items are not popped because of throttle.
|
11
12
|
EM::run do
|
12
|
-
# Create a queue that will pop off maximum of 2 items per second
|
13
|
-
# with a refill-limit of 1 second.
|
13
|
+
# Create a queue that will pop off maximum of 2 items per second.
|
14
14
|
queue = EM::ThrottledQueue.new(2)
|
15
15
|
|
16
16
|
queue.push 1 # you can push one item at a time
|
@@ -25,6 +25,8 @@ Example
|
|
25
25
|
# 1
|
26
26
|
# 2
|
27
27
|
|
28
|
+
Gem is on rubygems.org, so installation is a mere `gem install em-throttled_queue`.
|
29
|
+
|
28
30
|
What problem does EM-Throttled_Queue solve?
|
29
31
|
-------------------------------------------
|
30
32
|
At [radiofy](http://radiofy.se/) we consume a lot of external services. As we are rebuilding our internal structures we will be using EventMachine for the consumption of said services. Some of them have an applied rate-limit that will punish you if you don’t restrain how many queries you execute.
|
data/em-throttled_queue.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{em-throttled_queue}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Kim Burgestrand"]
|
12
|
-
s.date = %q{2011-02-
|
12
|
+
s.date = %q{2011-02-20}
|
13
13
|
s.email = %q{kim@burgestrand.se}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -23,6 +23,7 @@ Gem::Specification.new do |s|
|
|
23
23
|
"README.markdown",
|
24
24
|
"Rakefile",
|
25
25
|
"em-throttled_queue.gemspec",
|
26
|
+
"lib/em-throttled_queue.rb",
|
26
27
|
"lib/em/throttled_queue.rb",
|
27
28
|
"lib/em/throttled_queue/version.rb",
|
28
29
|
"lib/eventmachine/throttled_queue.rb",
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'em/throttled_queue'
|
data/spec/throttled_queue.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'em
|
1
|
+
require 'em-throttled_queue'
|
2
2
|
require 'minitest/autorun'
|
3
3
|
require 'minitest/spec'
|
4
4
|
|
@@ -6,7 +6,7 @@ class << MiniTest::Spec
|
|
6
6
|
def it_enhanced(*args, &block)
|
7
7
|
it_original(*args) do
|
8
8
|
EM::run(&block)
|
9
|
-
end
|
9
|
+
end unless block.nil?
|
10
10
|
end
|
11
11
|
|
12
12
|
alias_method :it_original, :it
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: em-throttled_queue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 1.0.
|
5
|
+
version: 1.0.3
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Kim Burgestrand
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-02-
|
13
|
+
date: 2011-02-20 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -85,6 +85,7 @@ files:
|
|
85
85
|
- README.markdown
|
86
86
|
- Rakefile
|
87
87
|
- em-throttled_queue.gemspec
|
88
|
+
- lib/em-throttled_queue.rb
|
88
89
|
- lib/em/throttled_queue.rb
|
89
90
|
- lib/em/throttled_queue/version.rb
|
90
91
|
- lib/eventmachine/throttled_queue.rb
|