Skip to content

Conversation

@Aerendel
Copy link

Adds support for specifying a per-rpc timeout rather than being forced to use a single timeout across the whole twirp client. This is something that my team is needing so we aren't required to create entire new clients just for specific RPCs that we want to allow longer timeouts for. Since Faraday supports this natively, it makes sense to expose it here.

client.hello({name: 'World'}, timeout: 5)

end
end

if req_opts && req_opts[:timeout] && req_opts[:timeout].is_a?(Integer) && req_opts[:timeout] > 0
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a choice to ignore non positive Integer values because Faraday doesn't actually check this and fails rather hard with a NoMethod error if you don't pass in a number. If ignoring invalid values doesn't sound good, we could instead raise a ArgumentError here and make the request fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant