fastbeans 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
- metadata.gz: 253535af0467722585d09f5e68012b7d7cf376d4
4
- data.tar.gz: 9482dc05865476f6b32629a26ccadc9ada5365c8
3
+ metadata.gz: 5936875dd05eed4d051e79ade5a96ff780098367
4
+ data.tar.gz: 393572d7da151951bdf6d454094e3b52f0dfb149
5
5
  !binary "U0hBNTEy":
6
- metadata.gz: d0cad8311ce4a55d7c198a5b2443777fd362bffb77df3819731ac6b2e694967af67c542684df871f519732014a0f17e645ed715d01accc07d55e75f81436fa71
7
- data.tar.gz: d390aa9d9117303fac53508e8716bd193cf1831b756767707d2dc7ae9db7f1ae58a393442143fbe37ba902e0639711ce28557bbfc5f56311b80637ad68e4754f
6
+ metadata.gz: 12a76b54d34d4279983c12be6d6b4ac507c0925b6de12a9d840ab32713d1db5714afbd5173a1f187fbf30f5114ce88b9f7ed6070a5abcfa993ca824e07528b01
7
+ data.tar.gz: f868e81095eca258bbd8c510bbcf45d353774bca61f83ce3d1f89a63616b3f3ee287666e16a33a5d5d06b9496ef71d9d9cf814ffeba2f1e22a939955728566e2
@@ -44,7 +44,7 @@ module Fastbeans
44
44
  retries = 0
45
45
  begin
46
46
  call_without_retries(data)
47
- rescue Fastbeans::RemoteConnectionFailed => e
47
+ rescue Fastbeans::RemoteConnectionFailed, Fastbeans::ResponseReadTimeout => e
48
48
  Fastbeans.debug(e)
49
49
  if retries < MAX_RETRIES
50
50
  Fastbeans.debug("Retrying (#{retries} out of #{MAX_RETRIES} retries)")
@@ -10,5 +10,6 @@ module Fastbeans
10
10
  class RemoteConnectionDead < Fastbeans::RPCException; end
11
11
  class AutogeneratedException < Fastbeans::RPCException; end
12
12
  class ResponseSignatureMismatch < RemoteConnectionFailed; end
13
-
13
+ class ResponseReadTimeout < RemoteCallFailed; end
14
+
14
15
  end
@@ -1,10 +1,13 @@
1
1
  require 'digest/md5'
2
2
  require 'fastbeans/response'
3
+ require 'timeout'
3
4
 
4
5
  module Fastbeans
5
6
  class Request
6
7
  attr_reader :connection
7
8
 
9
+ RESPONSE_READ_TIMEOUT = 120
10
+
8
11
  def initialize(connection)
9
12
  @connection = connection
10
13
  end
@@ -29,8 +32,13 @@ module Fastbeans
29
32
  end
30
33
 
31
34
  def read_response(sock, call_data)
32
- raw_resp = MessagePack.load(sock)
35
+ raw_resp = Timeout.timeout(RESPONSE_READ_TIMEOUT, Fastbeans::ResponseReadTimeout) do
36
+ MessagePack.load(sock)
37
+ end
33
38
  Fastbeans::Response.new(call_data, raw_resp)
39
+ rescue Fastbeans::ResponseReadTimeout
40
+ @connection.disconnect!
41
+ raise Fastbeans::ResponseReadTimeout, "Couldn't read response in #{RESPONSE_READ_TIMEOUT} seconds"
34
42
  end
35
43
 
36
44
  def perform(call_data)
@@ -1,3 +1,3 @@
1
1
  module Fastbeans
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fastbeans
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dima Sabanin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-15 00:00:00.000000000 Z
11
+ date: 2014-08-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack