Cap lookup time across fallback drivers and expose driver failures - #412
Open
tegos wants to merge 1 commit into
Open
Cap lookup time across fallback drivers and expose driver failures#412tegos wants to merge 1 commit into
tegos wants to merge 1 commit into
Conversation
Each driver got its own timeout, so the shipped config (one driver plus four fallbacks) took five times `http.timeout` before returning false, and HttpDriver swallowed every exception without reporting it. Refs stevebauman#182
Author
|
Hey @stevebauman, any chance you could take a look at this when you have a moment? No rush. Heads up that CI hasn't run yet, it needs an approval since it's my first PR here. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #182.
http.timeoutis per driver, not per lookup. With the shipped config (IpApiplus four fallbacks) an unreachable provider costs that timeout five times over, soLocation::get()in #182 returnedfalseafter ~16s withtimeout => 3. Reproduced against a socket that accepts but never responds: 15.71s currently, 4.04s withtotal_timeout => 4.HttpDriveralso swallowed every exception viarescue(..., false, false), so nothing explained the delay.Two changes:
total_timeout(defaultnull, so nothing changes unless set) gives the whole lookup one budget. Each driver's timeout is capped to what's left, and drivers with no time left aren't called.LookupFailedevent carryingdriver,ipandexception. Kept off the log on purpose, since a failing driver is normal when fallbacks are configured and Ignore Report #144 deliberately turned reporting off.throw_if($response->failed())became$response->throw(), so the event carries aRequestExceptionwith the status and body instead of a bareRuntimeException.Your call:
total_timeoutdefaults tonullfor compatibility, which means #182's config still takes ~15s. Happy to default it to a number instead.