fairway 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fairway (0.0.6)
4
+ fairway (0.0.8)
5
5
  activesupport
6
6
  hiredis
7
7
  redis
@@ -37,7 +37,9 @@ module Fairway
37
37
  fetches.shuffle.uniq
38
38
  end
39
39
 
40
- def retrieve_work
40
+ def retrieve_work(options = {})
41
+ options = { blocking: true }.merge(options)
42
+
41
43
  ::Sidekiq.logger.debug "#{self.class.name}#retrieve_work"
42
44
 
43
45
  fetch_order.each do |fetch|
@@ -50,7 +52,7 @@ module Fairway
50
52
  end
51
53
 
52
54
  ::Sidekiq.logger.debug "#{self.class.name}#retrieve_work got nil"
53
- sleep 1
55
+ sleep 1 if options[:blocking]
54
56
 
55
57
  return nil
56
58
  end
@@ -1,3 +1,3 @@
1
1
  module Fairway
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -91,6 +91,15 @@ module Fairway::Sidekiq
91
91
 
92
92
  fetch.retrieve_work
93
93
  end
94
+
95
+ it "doesn't sleep if blocking option is false" do
96
+ fetch.should_not_receive(:sleep)
97
+
98
+ fetchA.stub(retrieve_work: nil)
99
+ fetchB.stub(retrieve_work: nil)
100
+
101
+ fetch.retrieve_work(blocking: false)
102
+ end
94
103
  end
95
104
  end
96
105
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fairway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
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: 2013-03-17 00:00:00.000000000 Z
12
+ date: 2013-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport