diff options
author | Eric Wong <normalperson@yhbt.net> | 2011-12-06 20:54:08 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2011-12-06 12:55:21 -0800 |
commit | bafa6f41dbfda371e248656e50441bc7f6503826 (patch) | |
tree | 31825f3c5ce4d8c8a32494ba0962f0a5eec00c8b | |
parent | d5f49b90ec7461b07e88eb2e13f9b510190be256 (diff) | |
download | mogilefs-client-bafa6f41dbfda371e248656e50441bc7f6503826.tar.gz |
It seems our timeout values are sometimes too low :<
-rw-r--r-- | lib/mogilefs/socket/kgio.rb | 3 | ||||
-rw-r--r-- | lib/mogilefs/socket/pure_ruby.rb | 2 | ||||
-rw-r--r-- | lib/mogilefs/socket_common.rb | 4 |
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/mogilefs/socket/kgio.rb b/lib/mogilefs/socket/kgio.rb index 111384a..f752e83 100644 --- a/lib/mogilefs/socket/kgio.rb +++ b/lib/mogilefs/socket/kgio.rb @@ -42,7 +42,8 @@ class MogileFS::Socket < Kgio::Socket expect = buf.bytesize case rc = kgio_trywrite(buf) when :wait_writable - kgio_wait_writable(timeout) or request_truncated!(written, expect) + kgio_wait_writable(timeout) or + request_truncated!(written, expect, timeout) when String written += expect - rc.bytesize buf = rc diff --git a/lib/mogilefs/socket/pure_ruby.rb b/lib/mogilefs/socket/pure_ruby.rb index b820b20..25e0bfb 100644 --- a/lib/mogilefs/socket/pure_ruby.rb +++ b/lib/mogilefs/socket/pure_ruby.rb @@ -62,7 +62,7 @@ class MogileFS::Socket < Socket end rescue Errno::EAGAIN IO.select(nil, [self], nil, timeout) or - request_truncated!(written, expect) + request_truncated!(written, expect, timeout) end while true end end diff --git a/lib/mogilefs/socket_common.rb b/lib/mogilefs/socket_common.rb index fa77432..298e3da 100644 --- a/lib/mogilefs/socket_common.rb +++ b/lib/mogilefs/socket_common.rb @@ -17,9 +17,9 @@ module MogileFS::SocketCommon "#@mogilefs_addr never became readable" end - def request_truncated!(written, expect) + def request_truncated!(written, expect, timeout) raise MogileFS::RequestTruncatedError, - "request truncated (sent #{written} expected #{expect})" + "request truncated (sent #{written} expected #{expect}) after #{timeout}s" end SEP_RE = /\A(.*?#{Regexp.escape("\n")})/ |