-
Notifications
You must be signed in to change notification settings - Fork 547
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Timeout interrupt handling on Ruby 2.3 #671
Conversation
Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8 in favor of Timeout::Error, but only 2.1.x and 2.2.x have backward- compatibility aliases.
Known failure on Ruby 2.3/trunk: brianmario/mysql2#671
# but is present in earlier 2.1.x and 2.2.x, so we provide a shim. | ||
# | ||
# Set our own constant instead of modifying core ::Timeout. | ||
TimeoutError = if defined?(::Timeout::ExitException) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better or worse to use a variable instead of a constant?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Idiomatic to use a constant when it won't be reassigned and we want lexical lookup from an instance method. If this is a value we needed to configure, using a class or instance attribute would make sense.
Known failure on Ruby 2.3/trunk: brianmario/mysql2#671 Fixes #21544
It occurs to me that we need this for Mysql2::Statement#execute as well. To avoid duplicating code, maybe we should move this up to lib/mysql2.rb in the Mysql2 or Mysql2::Util modules? |
…ent#execute Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8, in favor of Timeout::Error. Backwards compatible aliases are provided for Ruby 2.1.x and 2.2.x, but not earlier verions. With thanks to @jeremy for PR brianmario#671 and @yui-knk for PR brianmario#677, this commit also protects prepared statements from being interrupted, so the compat shim is in Mysql2::Util.
Let me know if #679 looks solid. |
👍 ! |
…ent#execute Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8, in favor of Timeout::Error. Backwards compatible aliases are provided for Ruby 2.1.x and 2.2.x, but not earlier verions. With thanks to @jeremy for PR brianmario#671 and @yui-knk for PR brianmario#677, this commit also protects prepared statements from being interrupted, so the compat shim is in Mysql2::Util.
…ent#execute Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8, in favor of Timeout::Error. Backwards compatible aliases are provided for Ruby 2.1.x and 2.2.x, but not earlier verions. With thanks to @jeremy for PR brianmario#671 and @yui-knk for PR brianmario#677, this commit also protects prepared statements from being interrupted, so the compat shim is in Mysql2::Util.
…ent#execute Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8, in favor of Timeout::Error. Backwards compatible aliases are provided for Ruby 2.1.x and 2.2.x, but not earlier verions. With thanks to @jeremy for PR brianmario#671 and @yui-knk for PR brianmario#677, this commit also protects prepared statements from being interrupted, so the compat shim is in Mysql2::Util.
…ent#execute Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8, in favor of Timeout::Error. Backwards compatible aliases are provided for Ruby 2.1.x and 2.2.x, but not earlier verions. With thanks to @jeremy for PR brianmario#671 and @yui-knk for PR brianmario#677, this commit also protects prepared statements from being interrupted, so the compat shim is in Mysql2::Util.
…ent#execute Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8, in favor of Timeout::Error. Backwards compatible aliases are provided for Ruby 2.1.x and 2.2.x, but not earlier verions. With thanks to @jeremy for PR brianmario#671 and @yui-knk for PR brianmario#677, this commit also protects prepared statements from being interrupted, so the compat shim is in Mysql2::Util.
…ent#execute Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8, in favor of Timeout::Error. Backwards compatible aliases are provided for Ruby 2.1.x and 2.2.x, but not earlier verions. With thanks to @jeremy for PR brianmario#671 and @yui-knk for PR brianmario#677, this commit also protects prepared statements from being interrupted, so the compat shim is in Mysql2::Util.
…ent#execute Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8, in favor of Timeout::Error. Backwards compatible aliases are provided for Ruby 2.1.x and 2.2.x, but not earlier verions. With thanks to @jeremy for PR brianmario#671 and @yui-knk for PR brianmario#677, this commit also protects prepared statements from being interrupted, so the compat shim is in Mysql2::Util.
…ent#execute Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8, in favor of Timeout::Error. Backwards compatible aliases are provided for Ruby 2.1.x and 2.2.x, but not earlier verions. With thanks to @jeremy for PR brianmario#671 and @yui-knk for PR brianmario#677, this commit also protects prepared statements from being interrupted, so the compat shim is in Mysql2::Util.
…ent#execute Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8, in favor of Timeout::Error. Backwards compatible aliases are provided for Ruby 2.1.x and 2.2.x, but not earlier verions. With thanks to @jeremy for PR brianmario#671 and @yui-knk for PR brianmario#677, this commit also protects prepared statements from being interrupted, so the compat shim is in Mysql2::Util.
Timeout::ExitException was removed in Ruby 2.3.0, 2.2.3, and 2.1.8
in favor of Timeout::Error, but only 2.1.x and 2.2.x have backward-
compatibility aliases.
Along with #669 and #670, this makes tests green for me on latest Ruby trunk.