superbolt-future 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/superbolt/future/runner/requeue.rb +3 -3
- data/lib/superbolt/future/version.rb +1 -1
- data/spec/app_spec.rb +9 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13ea5c3d3996150ae1911b8e4d53f223704a7732
|
4
|
+
data.tar.gz: 70d84e16520960ee51a04f959e77c2598b63ad62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f50f4a2815352c35e2f9af7caf127d4b114cf597e3edb63697d2c84a88756ae805f4aee37ec6f18a3697a378deeba49d2288eefa952d110bb5d269698a230df0
|
7
|
+
data.tar.gz: 028da1fb1837ae1ff3db19234e24aa033a972a3123940d7595489923ebdc2842618917a28e3255df7af7e80b61c307312f99ee2d79f12cf15b560891da56194d
|
@@ -3,7 +3,7 @@ module Superbolt
|
|
3
3
|
module Runner
|
4
4
|
class Requeue < ::Superbolt::Runner::AckOne
|
5
5
|
def subscribe
|
6
|
-
queue.subscribe(ack: true) do |delivery_info, metadata, payload|
|
6
|
+
queue.subscribe(ack: true, block: true) do |delivery_info, metadata, payload|
|
7
7
|
message = Superbolt::IncomingMessage.new(delivery_info, payload, channel)
|
8
8
|
process(message)
|
9
9
|
end
|
@@ -29,7 +29,7 @@ module Superbolt
|
|
29
29
|
time = parsed_message["future"]
|
30
30
|
q = if Time.parse(time) > Time.now
|
31
31
|
logger.info("Requeueing message to #{time}")
|
32
|
-
future_queue
|
32
|
+
future_queue
|
33
33
|
else
|
34
34
|
logger.info("Sending message #{parsed_message} to worker queue")
|
35
35
|
worker_queue
|
@@ -51,4 +51,4 @@ module Superbolt
|
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
54
|
-
end
|
54
|
+
end
|
data/spec/app_spec.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Superbolt::App do
|
3
|
+
describe Superbolt::App do
|
4
4
|
let(:app) {
|
5
5
|
Superbolt::Future::App.new(name, {logger: logger})
|
6
|
-
}
|
6
|
+
}
|
7
7
|
|
8
8
|
before do
|
9
9
|
future_queue.clear
|
@@ -25,7 +25,7 @@ describe Superbolt::App do
|
|
25
25
|
let(:quit_queue) { Superbolt::Queue.new("#{name}_#{env}.future.quit") }
|
26
26
|
|
27
27
|
context 'when the future message key is in the past' do
|
28
|
-
let(:message) {
|
28
|
+
let(:message) {
|
29
29
|
{
|
30
30
|
origin: 'origin',
|
31
31
|
event: 'do_something',
|
@@ -38,9 +38,9 @@ describe Superbolt::App do
|
|
38
38
|
|
39
39
|
it "moves the message from the future queue to the worker queue" do
|
40
40
|
future_queue.push(message)
|
41
|
-
|
41
|
+
|
42
42
|
app.run do |arguments|
|
43
|
-
|
43
|
+
app.quit
|
44
44
|
end
|
45
45
|
|
46
46
|
worker_queue.size.should == 1
|
@@ -49,7 +49,7 @@ describe Superbolt::App do
|
|
49
49
|
end
|
50
50
|
|
51
51
|
context 'when the time is in the future' do
|
52
|
-
let(:message) {
|
52
|
+
let(:message) {
|
53
53
|
{
|
54
54
|
origin: 'origin',
|
55
55
|
event: 'do_something',
|
@@ -62,13 +62,13 @@ describe Superbolt::App do
|
|
62
62
|
|
63
63
|
it "puts the message back on the future queue" do
|
64
64
|
future_queue.push(message)
|
65
|
-
|
65
|
+
|
66
66
|
app.run do |arguments|
|
67
|
-
|
67
|
+
app.quit
|
68
68
|
end
|
69
69
|
|
70
70
|
worker_queue.size.should == 0
|
71
71
|
future_queue.size.should > 1 # there is a race condition with the quit queue, everything async
|
72
72
|
end
|
73
73
|
end
|
74
|
-
end
|
74
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: superbolt-future
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Deepti Anand
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-07-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: superbolt
|