graphql-client
graphql-client copied to clipboard
default timeout configuration needed
@josh Is their a way to configure Session open_timeout, read_timeout values?
@krishnarohitreddy I think you can do that when you define the http like:
GraphQL::Client::HTTP.new("URL") do
def connection
Net::HTTP.new(uri.host, uri.port).tap do |client|
client.open_timeout = 5
client.read_timeout = 5
client.use_ssl = uri.scheme == "https"
end
end
end
If you want to use all of the Net::HTTP config from GraphQL::Client::HTTP#connection
, you can piggyback off of what it normally returns. E.g.
GraphQL::Client::HTTP.new("URL") do
def connection
super.tap do |client|
client.read_timeout = 5
end
end
end
Though those solutions work. I think the community would be happier in general if the library provides an interface for changing this setting, instead of having to directly set up the underlying Net::Http object: If the library decides to change its implementation details
my code will be broken.
But still, thanks for providing a solution for the problem