pipeline_toolkit 1.2.23 → 1.2.24
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.
@@ -45,9 +45,12 @@ module PipelineToolkit
|
|
45
45
|
|
46
46
|
def receive_line(message_coded)
|
47
47
|
DefaultLogger.debug("Raw message: #{message_coded}") if options[:env] == "development"
|
48
|
-
message = MessageCoder.decode(message_coded
|
48
|
+
message = MessageCoder.decode(message_coded)
|
49
49
|
DefaultLogger.debug("Message: #{message.inspect}") if options[:env] == "development"
|
50
50
|
@target.process(message)
|
51
|
+
rescue MessagePack::UnpackError => e
|
52
|
+
DefaultLogger.error("Couldn't unpack message: #{message_coded.inspect}")
|
53
|
+
raise e
|
51
54
|
end
|
52
55
|
|
53
56
|
end
|
@@ -6,12 +6,6 @@ module PipelineToolkit
|
|
6
6
|
#
|
7
7
|
class MessageCoder
|
8
8
|
|
9
|
-
# Replace illegal chars (because we're using a line orientated procotol)
|
10
|
-
TRANSLATION = {
|
11
|
-
"\r" => "@@r",
|
12
|
-
"\n" => "@@n",
|
13
|
-
}
|
14
|
-
|
15
9
|
##
|
16
10
|
# Encode the hash message
|
17
11
|
#
|
@@ -21,7 +15,8 @@ module PipelineToolkit
|
|
21
15
|
# NB: Using Msgpack because it's 9-10x faster than altnatives
|
22
16
|
# See http://gist.github.com/190849
|
23
17
|
str = MessagePack.pack(message)
|
24
|
-
str.gsub!(
|
18
|
+
str.gsub!(/\r/, "@@r")
|
19
|
+
str.gsub!(/\n/, "@@n")
|
25
20
|
str
|
26
21
|
end
|
27
22
|
|
@@ -32,7 +27,8 @@ module PipelineToolkit
|
|
32
27
|
#
|
33
28
|
def self.decode(str)
|
34
29
|
str.chomp!
|
35
|
-
str.gsub!(
|
30
|
+
str.gsub!(/@@r/, "\r")
|
31
|
+
str.gsub!(/@@n/, "\n")
|
36
32
|
obj = MessagePack.unpack(str)
|
37
33
|
|
38
34
|
obj = case obj
|