worker_roulette 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -36,7 +36,7 @@ WorkerRoulette lets you have thousands of competing consumers (distrubted over a
36
36
  end
37
37
 
38
38
  ##Caveat Emptor
39
- While WorkerRoulette does promise to keep the messages of each consumer processed in order by competing consumers, it does NOT guarantee the order in which the queues themselves will be processed. In general, work is processed in a FIFO order, but for performance reasons this has been left a loose FIFO. For example, if Abdul enqueue_work_orders some ordered messages ('1', '2', and '3') and then so do Mark and Wanda, Mark's messages may be processed first, then it would likely be Abdul's, and then Wanda's. However, even though Mark jumped the line, Abdul's messages will still be processed the order he enqueue_work_orderd them ('1', '2', then '3').
39
+ While WorkerRoulette does promise to keep the messages of each consumer processed in order by competing consumers, it does NOT guarantee the order in which the queues themselves will be processed. In general, work is processed in a FIFO order, but for performance reasons this has been left a loose FIFO. For example, if Abdul enqueue_work_orders some ordered messages ('1', '2', and '3') and then so do Mark and Wanda, Mark's messages may be processed first, then it would likely be Abdul's, and then Wanda's. However, even though Mark jumped the line, Abdul's messages will still be processed the order he enqueue_work_orderd them ('1', '2', then '3').
40
40
 
41
41
  ## Installation
42
42
 
@@ -33,12 +33,12 @@ module WorkerRoulette
33
33
  end
34
34
 
35
35
  def enqueue_work_order(work_order, headers = {})
36
- work_order = {headers: default_headers.merge(headers), payload: work_order}
36
+ work_order = {'headers' => default_headers.merge(headers), 'payload' => work_order}
37
37
  enqueue_work_order_without_headers(work_order)
38
38
  end
39
39
 
40
40
  def default_headers
41
- Hash[sender: sender]
41
+ Hash['sender' => sender]
42
42
  end
43
43
  end
44
44
  end
@@ -1,3 +1,3 @@
1
1
  module WorkerRoulette
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
@@ -1,7 +1,7 @@
1
1
  require "worker_roulette/version"
2
+ require 'oj'
2
3
  require 'redis'
3
4
  require 'hiredis'
4
- require 'oj'
5
5
  require 'em-synchrony'
6
6
 
7
7
  Dir[File.join(File.dirname(__FILE__),'worker_roulette','**','*.rb')].sort.each { |file| require file.gsub(".rb", "")}
@@ -3,10 +3,10 @@ require "spec_helper"
3
3
  describe WorkerRoulette do
4
4
  let(:sender) {'katie_80'}
5
5
  let(:work_orders) {["hello", "foreman"]}
6
- let(:default_headers) {Hash[headers: {sender: sender}]}
7
- let(:hello_work_order) {Hash[payload: "hello"]}
8
- let(:foreman_work_order) {Hash[payload: "foreman"]}
9
- let(:work_orders_with_headers) {default_headers.merge({payload: work_orders})}
6
+ let(:default_headers) {Hash['headers' => {'sender' => sender}]}
7
+ let(:hello_work_order) {Hash['payload' => "hello"]}
8
+ let(:foreman_work_order) {Hash['payload' => "foreman"]}
9
+ let(:work_orders_with_headers) {default_headers.merge({'payload' => work_orders})}
10
10
  let(:jsonized_work_orders_with_headers) {[Oj.dump(work_orders_with_headers)]}
11
11
 
12
12
  let(:redis) {Redis.new(WorkerRoulette.redis_config)}
@@ -34,7 +34,7 @@ describe WorkerRoulette do
34
34
  it "should enqueue_work_order two work_orders in the sender's slot in the switchboard" do
35
35
  subject.enqueue_work_order(work_orders.first)
36
36
  subject.enqueue_work_order(work_orders.last)
37
- redis.lrange(sender, 0, -1).should == work_orders.map {|m| Oj.dump(default_headers.merge({payload: m})) }
37
+ redis.lrange(sender, 0, -1).should == work_orders.map {|m| Oj.dump(default_headers.merge({'payload' => m})) }
38
38
  end
39
39
 
40
40
  it "should enqueue_work_order an array of work_orders without headers in the sender's slot in the switchboard" do
@@ -48,9 +48,9 @@ describe WorkerRoulette do
48
48
  end
49
49
 
50
50
  it "should enqueue_work_order an array of work_orders with additional headers in the sender's slot in the switchboard" do
51
- extra_headers = {foo: :bars}
51
+ extra_headers = {'foo' => 'bars'}
52
52
  subject.enqueue_work_order(work_orders, extra_headers)
53
- work_orders_with_headers[:headers].merge!(extra_headers)
53
+ work_orders_with_headers['headers'].merge!(extra_headers)
54
54
  redis.lrange(sender, 0, -1).should == [Oj.dump(work_orders_with_headers)]
55
55
  end
56
56
 
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["classicist@gmail.com"]
11
11
  spec.description = %q{Write a gem description}
12
12
  spec.summary = %q{Write a gem summary}
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/nexiahome/worker_roulette"
14
14
 
15
15
  spec.files = `git ls-files`.split($/)
16
16
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: worker_roulette
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
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: 2014-02-13 00:00:00.000000000 Z
12
+ date: 2014-02-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oj
@@ -226,7 +226,7 @@ files:
226
226
  - spec/integration/worker_roulette_spec.rb
227
227
  - spec/spec_helper.rb
228
228
  - worker_roulette.gemspec
229
- homepage: ''
229
+ homepage: https://github.com/nexiahome/worker_roulette
230
230
  licenses: []
231
231
  post_install_message:
232
232
  rdoc_options: []