perennial 1.2.2 → 1.2.3
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.
@@ -26,6 +26,9 @@ end
|
|
26
26
|
|
27
27
|
class Perennial::Protocols::PureRuby::JSONTransport
|
28
28
|
|
29
|
+
class Error < StandardError; end
|
30
|
+
class NoConnection < Error; end
|
31
|
+
|
29
32
|
@@callbacks = {}
|
30
33
|
|
31
34
|
RETRY_DELAY = 30.0
|
@@ -51,10 +54,18 @@ class Perennial::Protocols::PureRuby::JSONTransport
|
|
51
54
|
|
52
55
|
def read_message
|
53
56
|
with_socket do |s|
|
54
|
-
|
55
|
-
|
57
|
+
raise NoConnection, "no connection the server at #{@host}:#{@port}" if s.nil?
|
58
|
+
message = nil
|
59
|
+
begin
|
60
|
+
Perennial::TimerImplementation.timeout(timeout) do
|
61
|
+
message = JSON.parse(s.gets.strip)
|
62
|
+
end
|
63
|
+
rescue Timeout::Error
|
64
|
+
return nil, nil
|
65
|
+
end
|
66
|
+
return nil, nil if !message.is_a?(Hash)
|
56
67
|
action, payload = message["action"], message["payload"]
|
57
|
-
return
|
68
|
+
return nil, nil if !action.is_a?(String)
|
58
69
|
payload = {} unless payload.is_a?(Hash)
|
59
70
|
# We have a processed callback - huzzah!
|
60
71
|
if payload.has_key?("callback-id")
|
data/lib/perennial.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: perennial
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darcy Laycock
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-03 00:00:00 +08:00
|
13
13
|
default_executable: perennial
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|