]> cat aescling's git repositories - mastodon.git/commit
Fix connect timeout not being enforced (#9329)
authorEugen Rochko <eugen@zeonfederated.com>
Thu, 22 Nov 2018 19:12:04 +0000 (20:12 +0100)
committerGitHub <noreply@github.com>
Thu, 22 Nov 2018 19:12:04 +0000 (20:12 +0100)
commitfd8145d2322d8b13b6aaa9cd2a61331ff660c9dd
tree7466262da5fde059add6d1779df2ed4db57f11e8
parent824497fbced31cb293fa1baee96105c666e34916
Fix connect timeout not being enforced (#9329)

* Fix connect timeout not being enforced

The loop was catching the timeout exception that should stop execution, so the next IP would no longer be within a timed block, which led to requests taking much longer than 10 seconds.

* Use timeout on each IP attempt, but limit to 2 attempts

* Fix code style issue

* Do not break Request#perform if no block given

* Update method stub in spec for Request

* Move timeout inside the begin/rescue block

* Use Resolv::DNS with timeout of 1 to get IP addresses

* Update Request spec to stub Resolv::DNS instead of Addrinfo

* Fix Resolve::DNS stubs in Request spec
app/lib/request.rb
spec/lib/request_spec.rb