X Tutup
Skip to content

fix: make update_in_place accept _timeout and only disable timeout at…#11466

Merged
cdrini merged 2 commits intointernetarchive:masterfrom
SAYAN02-DEV:Refactor-solr-update_in_place
Nov 17, 2025
Merged

fix: make update_in_place accept _timeout and only disable timeout at…#11466
cdrini merged 2 commits intointernetarchive:masterfrom
SAYAN02-DEV:Refactor-solr-update_in_place

Conversation

@SAYAN02-DEV
Copy link
Contributor

Closes #11459

Fix — Prevent unconditional disabling of client timeouts inside Solr's in-place update method by adding an optional _timeout parameter. Trending updater callers that need to opt out of timeouts explicitly pass _timeout=None

Technical

  1. Solr.update_in_place signature changed from
    update_in_place(self, request, commit: bool = False)
    to
    update_in_place(self, request, commit: bool = False, _timeout: int | None = DEFAULT_SOLR_TIMEOUT_SECONDS)
  2. The method now forwards _timeoutto httpx.Client.post(timeout=_timeout)instead of unconditionally using timeout=None
  3. The two trending updater scripts explicitly call update_in_place(..., _timeout=None)so they keep the previous behavior (no client timeout) for large/batch updates.

Screenshot

Testing

Stakeholders

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 _timeout parameter to update_in_place() with default value of DEFAULT_SOLR_TIMEOUT_SECONDS (10 seconds)
  • Updated trending updater scripts to explicitly pass _timeout=None to maintain their previous behavior (no timeout for large batch updates)
  • Removed the hardcoded timeout=None in 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.

Copy link
Collaborator

@RayBB RayBB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! I didn't test it but it seems like exactly what we want. @cdrini can you check and merge?

Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 !

@cdrini cdrini merged commit 54b665c into internetarchive:master Nov 17, 2025
4 checks passed
@SAYAN02-DEV SAYAN02-DEV deleted the Refactor-solr-update_in_place branch November 18, 2025 06:06
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.

Refactor solr update_in_place timeout

4 participants

X Tutup