fix: make update_in_place accept _timeout and only disable timeout at…#11466
Merged
cdrini merged 2 commits intointernetarchive:masterfrom Nov 17, 2025
Merged
Conversation
for more information, see https://pre-commit.ci
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where Solr's update_in_place method unconditionally disabled client timeouts. The fix adds an optional _timeout parameter that defaults to the standard 10-second timeout, while allowing callers to opt out when needed.
- Added
_timeoutparameter toupdate_in_place()with default value ofDEFAULT_SOLR_TIMEOUT_SECONDS(10 seconds) - Updated trending updater scripts to explicitly pass
_timeout=Noneto maintain their previous behavior (no timeout for large batch updates) - Removed the hardcoded
timeout=Nonein favor of the configurable parameter
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| openlibrary/utils/solr.py | Added _timeout parameter with type annotations and default value; method now forwards this to the httpx client instead of unconditionally disabling timeouts |
| scripts/solr_updater/trending_updater_hourly.py | Explicitly passes _timeout=None to maintain previous no-timeout behavior for batch operations |
| scripts/solr_updater/trending_updater_daily.py | Explicitly passes _timeout=None to maintain previous no-timeout behavior for batch operations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cdrini
approved these changes
Nov 17, 2025
Collaborator
cdrini
left a comment
There was a problem hiding this comment.
Lgtm! Not testing since this one is a bit tricky to test, and the change looks low risk. I will monitor after the next deploy. Thank you @SAYAN02-DEV !
b3nten
pushed a commit
to b3nten/openlibrary
that referenced
this pull request
Nov 18, 2025
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 #11459
Fix — Prevent unconditional disabling of client timeouts inside Solr's in-place update method by adding an optional
_timeoutparameter. Trending updater callers that need to opt out of timeouts explicitly pass_timeout=NoneTechnical
Solr.update_in_placesignature changed fromupdate_in_place(self, request, commit: bool = False)to
update_in_place(self, request, commit: bool = False, _timeout: int | None = DEFAULT_SOLR_TIMEOUT_SECONDS)_timeouttohttpx.Client.post(timeout=_timeout)instead of unconditionally usingtimeout=Noneupdate_in_place(..., _timeout=None)so they keep the previous behavior (no client timeout) for large/batch updates.Screenshot
Testing
Stakeholders