diff options
author | Eric Wong <e@80x24.org> | 2017-03-23 00:52:36 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2017-03-23 00:52:36 +0000 |
commit | 01ef1822affbaf3ae564a6a5efdc6acce6cc90c2 (patch) | |
tree | b41857698d8c5d755950787c061e5b555e51f5b1 | |
parent | 0693deaed76bbe48aa84a13d7f263085f4708424 (diff) | |
download | mogilefs-client-01ef1822affbaf3ae564a6a5efdc6acce6cc90c2.tar.gz |
Due to the release of Ruby 2.4.1 with the necessary fix, it seems likely that future releases (if any) of the 2.2 and 2.3 series will avoid garbage on IO#write, too.
-rw-r--r-- | lib/mogilefs/socket_common.rb | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/mogilefs/socket_common.rb b/lib/mogilefs/socket_common.rb index ec9249f..53771c8 100644 --- a/lib/mogilefs/socket_common.rb +++ b/lib/mogilefs/socket_common.rb @@ -59,16 +59,21 @@ module MogileFS::SocketCommon # Workaround for https://bugs.ruby-lang.org/issues/13085 # (excessive garbage from IO#write) # This regression was introduced in Ruby 2.0 (r34847) - # and looks like it will be fixed in Ruby 2.4.1 and Ruby 2.5 + # and it is fixed in Ruby 2.4.1+ # backport request: https://bugs.ruby-lang.org/issues/13299 - rvn = RUBY_VERSION.split('.'.freeze).map(&:to_i) # "2.4.1" => [ 2, 4, 1 ] if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ruby' && - rvn[0] >= 2 && - ((rvn[1] == 4 && rvn[2] == 0) || (rvn[1] < 4)) - def write(buf) - # Blocking TCP writes would error out long before one day, - # and MogileFS won't allow file creations which take over a day. - timed_write(buf, 86400) + case RUBY_VERSION + when '2.0.0', + '2.1.0'..'2.1.9', + # we expect 2.2.7 and 2.3.4 to not need this + '2.2.0'..'2.2.6', + '2.3.0'..'2.3.3', + '2.4.0' # 2.4.1 is good! + def write(buf) + # Blocking TCP writes would error out long before one day, + # and MogileFS won't allow file creations which take over a day. + timed_write(buf, 86400) + end end end end |