Skip to content

Conversation

@gmegidish
Copy link
Member

@gmegidish gmegidish commented Dec 8, 2025

Summary by CodeRabbit

  • Refactor

    • Refactored HTTP endpoint request handling to support configurable timeout durations and improved internal request management.
  • Chores

    • Updated default HTTP client timeout settings and adjusted timeout values for source-related operations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2025

Walkthrough

Introduces configurable timeout handling for HTTP requests. An internal method getEndpointWithTimeout is added to handle GET requests with custom timeouts. The public GetEndpoint method delegates to this with a 5-second timeout. GetSource and GetSourceRaw use 60-second timeouts. The default HTTP client timeout increases from 5 to 60 seconds.

Changes

Cohort / File(s) Summary
Timeout mechanism implementation
devices/wda/requests.go
Introduces internal method getEndpointWithTimeout to perform GET requests with configurable timeouts. Updates GetEndpoint public wrapper to delegate to the new method with a fixed 5-second timeout.
Timeout configuration adjustments
devices/wda/source.go, devices/wda/types.go
Updates GetSource and GetSourceRaw to use getEndpointWithTimeout with 60-second timeout. Increases default HTTP client timeout from 5 to 60 seconds in NewWdaClient.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: increasing timeout to 60 seconds for UI dump operations on iOS, which is reflected in the modifications to GetSource, GetSourceRaw, and HTTP client timeout configuration.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-increase-timeout-for-ui-dump-to-60s-on-ios

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (3)
devices/wda/types.go (1)

24-28: Client timeout increase aligns with longer UI dump operations

Bumping the http.Client timeout to 60s is consistent with the new 60s /source calls and prevents the client-level timeout from aborting long-running dumps prematurely; change looks good. If more timeout variants are added later, consider centralizing them as named time.Duration constants for clarity.

devices/wda/source.go (1)

6-7: Using 60s timeout for source fetches matches the PR intent

Routing GetSource / GetSourceRaw through getEndpointWithTimeout(..., 60*time.Second) cleanly targets longer timeouts at the UI dump without changing other callers. You might optionally extract a const sourceTimeout = 60 * time.Second to avoid repeating the literal and make the intent self-documenting.

Also applies to: 80-89, 92-100

devices/wda/requests.go (1)

65-67: GetEndpoint wrapper preserves existing behavior; consider sharing the 5s default

Having GetEndpoint delegate to getEndpointWithTimeout(endpoint, 5*time.Second) keeps the public API and effective timeout the same while enabling longer timeouts for specific endpoints. Since 5*time.Second is also used in POST/DELETE, you could introduce a const defaultTimeout = 5 * time.Second to avoid magic numbers and keep these call sites in sync.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03174fe and 2979f09.

📒 Files selected for processing (3)
  • devices/wda/requests.go (2 hunks)
  • devices/wda/source.go (3 hunks)
  • devices/wda/types.go (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
devices/wda/requests.go (1)
devices/wda/types.go (1)
  • WdaClient (10-15)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: lint
🔇 Additional comments (1)
devices/wda/requests.go (1)

27-63: Configurable GET helper is implemented correctly

getEndpointWithTimeout cleanly encapsulates the GET flow with a per-call timeout, including status checks and JSON parsing, and is suitable for both short (5s) and long (60s) scenarios. Given that this now centralizes GET behavior, future adjustments to logging or error handling will be straightforward here.

@gmegidish gmegidish merged commit 1ba0bc1 into main Dec 8, 2025
15 checks passed
@gmegidish gmegidish deleted the fix-increase-timeout-for-ui-dump-to-60s-on-ios branch December 8, 2025 15:55
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.

2 participants