diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-12-11 08:47:39 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-12-11 08:55:29 +0000 |
commit | 3f342091cec9fcd5f99ba934444f17cd0c77de71 (patch) | |
tree | a6a40207d1938206b88c5fe3bd1757095ac67d54 /lib/mogilefs/new_file/common.rb | |
parent | 9d5f3208dab86837106b56f105af8bbb121f438a (diff) | |
download | mogilefs-client-3f342091cec9fcd5f99ba934444f17cd0c77de71.tar.gz |
This defaults to 1 hour (which matches the expiry time of a row in the MogileFS internal tempfile table).
Diffstat (limited to 'lib/mogilefs/new_file/common.rb')
-rw-r--r-- | lib/mogilefs/new_file/common.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/mogilefs/new_file/common.rb b/lib/mogilefs/new_file/common.rb index 38d0fd3..e959a21 100644 --- a/lib/mogilefs/new_file/common.rb +++ b/lib/mogilefs/new_file/common.rb @@ -19,8 +19,9 @@ module MogileFS::NewFile::Common MD5_TRAILER_NODES = {} # :nodoc: # EXPERIMENTAL def read_response(sock) - # mostly relying on SO_KEEPALIVE to timeout - case line = sock.timed_read(23, "", 7200) + tout = @opts[:new_file_max_time] || 3600.0 + start_time = @opts[:start_time] and tout -= Time.now - start_time + case line = sock.timed_read(23, "", tout > 0.0 ? tout : 0) when %r{^HTTP/\d\.\d\s+(2\d\d)\s} # success! when nil raise EmptyResponseError, 'Unable to read response line from server' |