boss_queue 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/boss_queue.gemspec +1 -1
- data/lib/boss_queue/boss_queue.rb +7 -4
- data/spec/boss_queue_spec.rb +9 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.10
|
data/boss_queue.gemspec
CHANGED
@@ -42,10 +42,13 @@ class BossQueue
|
|
42
42
|
work_done = false
|
43
43
|
self.sqs_queue.receive_message do |job_id|
|
44
44
|
# When a block is given, each message is yielded to the block and then deleted as long as the block exits normally - http://docs.aws.amazon.com/AWSRubySDK/latest/frames.html
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
begin
|
46
|
+
job = BossQueue::Job.shard(table_name).find(job_id.body)
|
47
|
+
job.queue_name = self.queue_name
|
48
|
+
job.work
|
49
|
+
work_done = true
|
50
|
+
rescue AWS::Record::RecordNotFound
|
51
|
+
end
|
49
52
|
end
|
50
53
|
work_done
|
51
54
|
end
|
data/spec/boss_queue_spec.rb
CHANGED
@@ -238,6 +238,15 @@ describe "BossQueue module" do
|
|
238
238
|
BossQueue.work
|
239
239
|
end
|
240
240
|
|
241
|
+
context "when the dequeued id does not match a BossQueue::Job object" do
|
242
|
+
it "should not raise an exception" do
|
243
|
+
BossQueue::Job.stub_chain(:shard, :find).and_raise(AWS::Record::RecordNotFound.new)
|
244
|
+
lambda {
|
245
|
+
BossQueue.work
|
246
|
+
}.should_not raise_error
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
241
250
|
it "should call work on the BossQueue::Job object" do
|
242
251
|
@job.should_receive(:work)
|
243
252
|
BossQueue.work
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: boss_queue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -160,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
160
160
|
version: '0'
|
161
161
|
segments:
|
162
162
|
- 0
|
163
|
-
hash:
|
163
|
+
hash: -2976249042738102520
|
164
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
165
|
none: false
|
166
166
|
requirements:
|