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 performance regression when checking if aws-crt is available. #2730

Merged
merged 2 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions gems/aws-sigv4/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
Unreleased Changes
------------------

* Issue - Fix performance regression when checking if `aws-crt` is available. (#2729)

1.5.0 (2022-04-20)
------------------

Expand Down
15 changes: 9 additions & 6 deletions gems/aws-sigv4/lib/aws-sigv4/signer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ module Sigv4
#
class Signer

@@use_crt =
begin
require 'aws-crt'
true
rescue LoadError
false
end

# @overload initialize(service:, region:, access_key_id:, secret_access_key:, session_token:nil, **options)
# @param [String] :service The service signing name, e.g. 's3'.
# @param [String] :region The region name, e.g. 'us-east-1'.
Expand Down Expand Up @@ -833,12 +841,7 @@ def crt_presign_url(options)
class << self

def use_crt?
begin
require 'aws-crt'
return true
rescue LoadError
return false
end
@@use_crt
end

# @api private
Expand Down