Skip to content

Cap lookup time across fallback drivers - #412

Merged
stevebauman merged 1 commit into
stevebauman:masterfrom
tegos:fix/lookup-timeout-budget
Oct 5, 2026
Merged

stevebauman merged 1 commit into
stevebauman:masterfrom
tegos:fix/lookup-timeout-budget

Conversation

@tegos

@tegos tegos commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

Closes #182.

http.timeout is per driver, not per lookup. With the shipped config (IpApi plus four fallbacks) an unreachable provider costs that timeout five times over, so Location::get() in #182 returned false after ~16s with timeout => 3. Reproduced against a socket that accepts but never responds: 14.02s currently, 4.05s with total_timeout => 4.

total_timeout (default null, 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.

I dropped the failure event that was here before to keep this focused on the timeout.

Your call: total_timeout defaults to null for compatibility, which means #182's config still takes ~15s. Happy to default it to a number instead.

@tegos

tegos commented Aug 20, 2026

Copy link
Copy Markdown
Contributor 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.

@tegos

tegos commented Sep 18, 2026

Copy link
Copy Markdown
Contributor Author

Hello! Bumping this one.
If it's too much in one go, I can split it - total timeout in one PR, the LookupFailed event in another.
Or trim it to just whichever half you'd want.

Either way, tell me what shape works and I'll rework it.

@tegos
tegos force-pushed the fix/lookup-timeout-budget branch from 1c0f306 to 1420d1c Compare October 3, 2026 13:40
@tegos tegos changed the title Cap lookup time across fallback drivers and expose driver failures Cap lookup time across fallback drivers Oct 3, 2026
@tegos

tegos commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

Trimmed this down to just the timeout budget. Dropped the failure event, process() keeps the old rescue(). One commit, 180 lines.

CI needs your approval to run.

Comment thread config/location.php
@stevebauman
stevebauman merged commit 3147f48 into stevebauman:master Oct 5, 2026
10 checks passed
@stevebauman

Copy link
Copy Markdown
Owner

Released in v7.7.0!

@tegos
tegos deleted the fix/lookup-timeout-budget branch October 6, 2026 06:41
@tegos

tegos commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, no problem about delay.

Now we can limit the total time.

With a few fallback drivers, one dead provider made the request wait for all their timeouts.

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.

Timeout settings

2 participants