Skip to content

fix: apply a default timeout to every HTTP request - #60

Open
codechrl wants to merge 4 commits into
Infisical:mainfrom
codechrl:fix-request-timeout
Open

codechrl wants to merge 4 commits into
Infisical:mainfrom
codechrl:fix-request-timeout

Conversation

@codechrl

@codechrl codechrl commented Sep 7, 2026 •

Copy link
Copy Markdown

InfisicalRequests called session.get, post, put, patch and delete without a timeout, so every request ran with the requests default of timeout=None. A server that accepts the connection and never replies leaves the caller blocked with no deadline and no exception. NETWORK_ERRORS already lists ReadTimeout and ConnectTimeout, so those with_retry branches could never be reached.

InfisicalRequests and InfisicalSDKClient now take a timeout parameter that defaults to 30 seconds and is passed to every request. A caller that wants the old behavior passes timeout=None, and one on a slow network can raise it.

No new dependencies. The default applies to existing callers without a code change on their side.

Every session call in InfisicalRequests ran without a timeout argument.
The requests default of timeout=None leaves the socket with no deadline.
A server that accepts a connection and never replies blocks the caller
indefinitely.

NETWORK_ERRORS already lists ReadTimeout and ConnectTimeout, so those
retry branches were unreachable.

Add a timeout parameter to InfisicalRequests and InfisicalSDKClient.
It defaults to 30 seconds and is passed to every request. Passing None
restores the previous behavior.
@greptile-apps

greptile-apps Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] No new blocking issue was found in these changes.

Summary

Adds a configurable 30-second timeout to the shared HTTP request layer.

  • Every SDK request now has a configurable timeout.

No new findings were accepted. Tests were not run.

Reviews (5) · Last reviewed commit: "Merge upstream/main into fix-request-tim..." · Reviewed by Greptile

Comment thread infisical_sdk/infisical_requests.py Resolved
Comment thread infisical_sdk/client.py Resolved
Comment thread infisical_sdk/client.py Resolved
The new default made ReadTimeout reachable for the first time. It is in
NETWORK_ERRORS, and post, patch and delete carry the same retry
decorator as get, so a write whose response was slow would be resent up
to four times after the server may already have applied it.

Writes now retry on a set that excludes ReadTimeout. A connect timeout
still retries on every verb, because the request never reached the
server. A read timeout on a write reaches the caller.

Also annotate the client timeout as Optional[float], since None is a
documented value, and say in the docstring that the value applies to
the connection and to the response on each attempt.
@codechrl
codechrl marked this pull request as draft September 7, 2026 06:54
@codechrl
codechrl marked this pull request as ready for review September 7, 2026 06:54
Comment thread tests/test_infisical_requests.py Resolved
@codechrl

codechrl commented Sep 7, 2026

Copy link
Copy Markdown
Author

@greptileai fixes pushed, please re-review

The retry tests exercised the real exponential backoff, which added
about a minute to the run for no added coverage.
@codechrl

codechrl commented Sep 7, 2026

Copy link
Copy Markdown
Author

@greptileai fixes pushed, please re-review

main now handles requests that must not run twice with post_once/delete_once
and CONNECT_ERRORS, so the read-timeout guard on post/patch/delete is dropped
in favour of that. This branch now only adds the timeout, applied to every
request including put, post_once and delete_once.
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