Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 17, 2025

This PR updates the default timeout for all HTTP requests from the previous conditional values (60s for GET, 120s for other methods) to a consistent 150 seconds across all HTTP methods.

Changes Made

Modified ddns/util/http.py:

  • Updated line 122 to use timeout=150 for all HTTP requests instead of the previous conditional logic
  • Ensures consistent timeout behavior regardless of HTTP method

Added test coverage in tests/test_util_http.py:

  • Added TestHttpRequestTimeout class with comprehensive test to verify the 150-second timeout
  • Tests both GET and POST requests to ensure consistent behavior
  • Uses proper mocking to capture and validate the timeout parameter

Impact

  • Consistent behavior: All HTTP methods (GET, POST, PUT, etc.) now use the same 150-second timeout
  • Improved reliability: Longer timeout reduces the chance of premature timeouts for slow DNS provider APIs
  • No breaking changes: All existing functionality continues to work correctly
  • Well-tested: New test ensures the timeout is properly applied

Testing

  • All 785 existing tests continue to pass
  • New timeout-specific test validates the 150-second timeout for both GET and POST requests
  • Manual verification confirms the timeout parameter is correctly set

Fixes #554.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: NewFuture <6290356+NewFuture@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] request 设置默认timeout feat: set default HTTP request timeout to 150 seconds Sep 17, 2025
@Copilot Copilot AI requested a review from NewFuture September 17, 2025 15:10
Copilot finished work on behalf of NewFuture September 17, 2025 15:10
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.

request 设置默认timeout
2 participants