superbolt 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +22 -0
- data/lib/superbolt/runner/default.rb +14 -5
- data/lib/superbolt/version.rb +1 -1
- data/spec/support/em_mocking.rb +9 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 968ca2d1026ac1b168a119f49a57c5f5c5bbf107
|
4
|
+
data.tar.gz: b8c817960cf0a1d73ace5eb4068eb35af4fb18b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ebad807328b0aaa33ca84477e517fc9c4655709a942d3143ac2563c38b4d6fe83729394b6365b1d8174c0a1cd1a4ca67b8757f8ef1aab7c9f8ce74f8f0dc9934
|
7
|
+
data.tar.gz: b37936716e7266e02c914a76c9eeb3a4da53059cacd62ea7b8d635a1098620c09a4e984abe0964b88623c6566d393e2b2fbb20ae02de8ec08713462798d7a8ce
|
data/Rakefile
CHANGED
@@ -1 +1,23 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
+
require "superbolt/tasks"
|
3
|
+
|
4
|
+
|
5
|
+
# This one is for locally testing your crazy ideas
|
6
|
+
task :environment do
|
7
|
+
class MySleeperCell < Superbolt::MessageHandler
|
8
|
+
def perform
|
9
|
+
sleep(rand(10))
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
Superbolt.config = {
|
14
|
+
connection_params: {
|
15
|
+
host: '127.0.0.1',
|
16
|
+
heartbeat: 1,
|
17
|
+
}
|
18
|
+
}
|
19
|
+
Superbolt.app_name = 'food'
|
20
|
+
Superbolt::Router.routes = {
|
21
|
+
'do-it' => 'MySleeperCell'
|
22
|
+
}
|
23
|
+
end
|
@@ -12,12 +12,21 @@ module Superbolt
|
|
12
12
|
|
13
13
|
def subscribe
|
14
14
|
queue.subscribe(ack: ack) do |metadata, payload|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
#Thanks again to LShift for this solution to long-running processes
|
16
|
+
#Defer keeps heartbeat running while the process finishes
|
17
|
+
EM.defer do
|
18
|
+
# this gets run on the thread pool
|
19
|
+
message = Superbolt::IncomingMessage.new(metadata, payload, channel)
|
20
|
+
processor = Superbolt::Processor.new(message, logger, &block)
|
21
|
+
unless processor.perform
|
22
|
+
on_error(message.parse, processor.exception)
|
23
|
+
end
|
24
|
+
|
25
|
+
EM.next_tick do
|
26
|
+
# this gets run back on the main loop
|
27
|
+
message.ack if ack
|
28
|
+
end
|
19
29
|
end
|
20
|
-
message.ack if ack
|
21
30
|
end
|
22
31
|
end
|
23
32
|
|
data/lib/superbolt/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: superbolt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- socialchorus
|
@@ -176,6 +176,7 @@ files:
|
|
176
176
|
- spec/spec_helper.rb
|
177
177
|
- spec/superbolt_spec.rb
|
178
178
|
- spec/support/commodore.jpg
|
179
|
+
- spec/support/em_mocking.rb
|
179
180
|
- spec/support/queue_helpers.rb
|
180
181
|
- superbolt.gemspec
|
181
182
|
homepage: ''
|
@@ -215,4 +216,5 @@ test_files:
|
|
215
216
|
- spec/spec_helper.rb
|
216
217
|
- spec/superbolt_spec.rb
|
217
218
|
- spec/support/commodore.jpg
|
219
|
+
- spec/support/em_mocking.rb
|
218
220
|
- spec/support/queue_helpers.rb
|