mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-11-30 00:00:47 -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
|
:ssl_ca_file => @@ssl_bundle_path
|
||||||
}
|
}
|
||||||
end
|
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})"
|
lang_version = "#{RUBY_VERSION} p#{RUBY_PATCHLEVEL} (#{RUBY_RELEASE_DATE})"
|
||||||
ua = {
|
ua = {
|
||||||
:bindings_version => Stripe::VERSION,
|
:bindings_version => Stripe::VERSION,
|
||||||
@ -197,6 +197,13 @@ module Stripe
|
|||||||
|
|
||||||
private
|
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)
|
def self.execute_request(opts)
|
||||||
RestClient::Request.execute(opts)
|
RestClient::Request.execute(opts)
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user