-
Notifications
You must be signed in to change notification settings - Fork 549
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix Timeout interrupt handling on Ruby 2.3 and protect Mysql2::Statem…
…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 #671 and @yui-knk for PR #677, this commit also protects prepared statements from being interrupted, so the compat shim is in Mysql2::Util.
- Loading branch information
Showing
5 changed files
with
43 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
module Mysql2 | ||
class Statement | ||
include Enumerable | ||
|
||
if Thread.respond_to?(:handle_interrupt) | ||
def execute(*args) | ||
Thread.handle_interrupt(::Mysql2::Util::TimeoutError => :never) do | ||
_execute(*args) | ||
end | ||
end | ||
else | ||
def execute(*args) | ||
_execute(*args) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters