Skip to content

Add custom request timeout support for VWS and CloudRecoService#2823

Merged
adamtheturtle merged 19 commits intomainfrom
adamtheturtle/custom-timeouts
Feb 15, 2026
Merged

Add custom request timeout support for VWS and CloudRecoService#2823
adamtheturtle merged 19 commits intomainfrom
adamtheturtle/custom-timeouts

Conversation

@adamtheturtle
Copy link
Member

@adamtheturtle adamtheturtle commented Feb 2, 2026

Summary

Adds support for configurable request timeouts in both VWS and CloudRecoService APIs. Previously, timeouts were hardcoded to 30 seconds. Now users can specify a custom timeout during client initialization.

Changes

  • Add optional request_timeout_seconds parameter to VWS and CloudRecoService constructors with 30-second default
  • Replace hardcoded timeout values with the configurable parameter
  • Add comprehensive tests for both default and custom timeout behavior

Testing

Tests verify that the default timeout is 30 seconds and that custom timeouts can be set and used successfully.


Note

Low Risk
Small, backwards-compatible change that only affects HTTP request timeout configuration and adds targeted tests; main risk is behavioral change if callers relied on the fixed 30s timeout.

Overview
Adds an optional request_timeout_seconds parameter to VWS and CloudRecoService constructors (defaulting to 30s) and threads it through to the underlying requests.request calls, replacing the previously hardcoded timeout.

Expands test coverage in test_vws.py and test_query.py to verify both default timeout behavior and custom timeout values (including (connect, read) tuples), and documents the change in CHANGELOG.rst.

Written by Cursor Bugbot for commit a69677c. This will update automatically on new commits. Configure here.

Allow users to configure request timeouts instead of using a hardcoded 30-second default. Both VWS and CloudRecoService now accept an optional request_timeout_seconds parameter during initialization, with proper defaults and documentation.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
adamtheturtle and others added 3 commits February 2, 2026 11:54
Add test_timeout_raises_on_slow_response and test_longer_timeout_succeeds
tests to both VWS and CloudRecoService. These tests simulate slow server
responses and verify that short timeouts actually raise Timeout exceptions.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use keyword arguments for patch.object and pytest.raises to satisfy
mypy's type checking.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The timeout parameter now accepts either a float (applied to both connect
and read timeouts) or a (connect, read) tuple, matching the requests
library's timeout interface. Updated docstrings to reference requests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

_target_api_request used plain @beartype which rejects int for float,
while VWS.__init__ used is_pep484_tower=True which accepts it. This
caused integer timeouts to pass construction but fail on first request.
Enable is_pep484_tower on _target_api_request and CloudRecoService too.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove branching and time.sleep from slow_request mocks, fixing
  coverage gaps (partial branches) and Windows CI timeouts
- Remove test_longer_timeout_succeeds (redundant with test_custom_timeout)
- Assert the timeout value is passed correctly instead of branching
- Remove unused time import and unused *args parameter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Upgrade vws-python-mock to 2026.2.15 which adds response_delay_seconds
parameter. Replace unittest.mock.patch-based timeout simulation with
MockVWS(response_delay_seconds=0.5), testing the real timeout mechanism
end-to-end.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…timeouts

# Conflicts:
#	tests/test_query.py
#	tests/test_vws.py
@adamtheturtle adamtheturtle merged commit 62599d9 into main Feb 15, 2026
16 checks passed
@adamtheturtle adamtheturtle deleted the adamtheturtle/custom-timeouts branch February 15, 2026 12:36
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

Comments