mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-11-29 00:01:18 -05:00
Due to a server misconfiguration issue, we were low on memory.
Attempting to spawn a subprocess to get the uname threw an out of memory error. Since the uname is only needed to provide diagnostic info in the User-Agent, it shouldn't cause stripe to fail.
This commit is contained in:
parent
ce34d9ef8b
commit
81ae6d7aee
@ -106,7 +106,7 @@ module Stripe
|
||||
:ssl_ca_file => @@ssl_bundle_path
|
||||
}
|
||||
end
|
||||
uname = (@@uname ||= RUBY_PLATFORM =~ /linux|darwin/i ? `uname -a 2>/dev/null`.strip : nil)
|
||||
uname = get_uname
|
||||
lang_version = "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})"
|
||||
ua = {
|
||||
:bindings_version => Stripe::VERSION,
|
||||
@ -197,6 +197,13 @@ module Stripe
|
||||
|
||||
private
|
||||
|
||||
def self.get_uname
|
||||
(@@uname ||= RUBY_PLATFORM =~ /linux|darwin/i ? `uname -a 2>/dev/null`.strip : nil)
|
||||
rescue Errno::ENOMEM => ex # couldn't create subprocess
|
||||
"uname lookup died"
|
||||
end
|
||||
|
||||
|
||||
def self.execute_request(opts)
|
||||
RestClient::Request.execute(opts)
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user