Skip to content
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

Closed

Conversation

jeremy
Copy link
Contributor

@jeremy jeremy commented Sep 7, 2015

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.

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.
# 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)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

@sodabrew sodabrew added this to the 0.4.1 milestone Sep 8, 2015
jeremy added a commit to rails/rails that referenced this pull request Sep 8, 2015
@sodabrew
Copy link
Collaborator

sodabrew commented Sep 8, 2015

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?

sodabrew added a commit to sodabrew/mysql2 that referenced this pull request Sep 9, 2015
…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.
@sodabrew
Copy link
Collaborator

sodabrew commented Sep 9, 2015

Let me know if #679 looks solid.

@jeremy
Copy link
Contributor Author

jeremy commented Sep 9, 2015

👍 !

@jeremy jeremy closed this Sep 9, 2015
@jeremy jeremy deleted the fix-timeout-interrupt-on-2.3 branch September 9, 2015 15:25
sodabrew added a commit to sodabrew/mysql2 that referenced this pull request Sep 10, 2015
…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.
sodabrew added a commit to sodabrew/mysql2 that referenced this pull request Sep 10, 2015
…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.
sodabrew added a commit to sodabrew/mysql2 that referenced this pull request Sep 10, 2015
…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.
sodabrew added a commit to sodabrew/mysql2 that referenced this pull request Sep 10, 2015
…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.
sodabrew added a commit to sodabrew/mysql2 that referenced this pull request Sep 13, 2015
…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.
sodabrew added a commit to sodabrew/mysql2 that referenced this pull request Sep 14, 2015
…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.
sodabrew added a commit to sodabrew/mysql2 that referenced this pull request Sep 14, 2015
…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.
sodabrew added a commit to sodabrew/mysql2 that referenced this pull request May 7, 2016
…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.
sodabrew added a commit to sodabrew/mysql2 that referenced this pull request May 7, 2016
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants