piper-ruby 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +4 -0
- data/lib/piper/actor.rb +13 -9
- data/lib/piper/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -26,6 +26,10 @@ an example of how to use the Piper::Actor module functions.
|
|
26
26
|
|
27
27
|
## Release Notes
|
28
28
|
|
29
|
+
### Release 1.2.1 - March 20, 2016
|
30
|
+
|
31
|
+
- Added rescue for Interrupt to avoid error message on shutdown with control C.
|
32
|
+
|
29
33
|
### Release 1.2.0 - March 20, 2016
|
30
34
|
|
31
35
|
- Added the Piper::Actor module to support the Piper Push Cache process flows.
|
data/lib/piper/actor.rb
CHANGED
@@ -18,15 +18,19 @@ module Piper
|
|
18
18
|
# Starts a JSON processing loop that reads from $stdin. The proc provided
|
19
19
|
# with the call should call ship() to continue on with the processing.
|
20
20
|
def self.process()
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
21
|
+
begin
|
22
|
+
Oj::load($stdin, :mode => :strict) { |json|
|
23
|
+
begin
|
24
|
+
id = json['id']
|
25
|
+
rec = json['rec']
|
26
|
+
yield(id, rec)
|
27
|
+
rescue Exception => e
|
28
|
+
ship(id, { 'kind' => 'Error', 'message' => e.message, 'class' => e.class.to_s }, 'error')
|
29
|
+
end
|
30
|
+
}
|
31
|
+
rescue Interrupt
|
32
|
+
# ^C or parent went away
|
33
|
+
end
|
30
34
|
end
|
31
35
|
|
32
36
|
# Ships or sends a response to the calling task in the Piper Flow.
|
data/lib/piper/version.rb
CHANGED