-
-
Save anonymous/076ca83cf691a3a386aa2cf1431b32ad to your computer and use it in GitHub Desktop.
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
class SfdcHTTP | |
attr_accessor :expiration_date, :client | |
def initialize | |
@@client ||= set_client | |
@@expiration_date = nil | |
end | |
class << self | |
def get_client | |
if expiration_date == nil | |
set_client | |
client | |
elsif Time.now - expiration_date < 240 | |
client | |
else | |
set_client | |
client | |
end | |
end | |
def set_client | |
expiration_date = Time.now | |
client = Manticore::Client.new( | |
keepalive: true, | |
pool_max: 50, | |
pool_max_per_route: 50, | |
ssl: { verify: :disable } | |
) | |
client | |
end | |
end # End class methods | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment