Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make api-client timeout configurable, increase in admin cli #1950

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

oddgrd
Copy link
Contributor

@oddgrd oddgrd commented Jan 7, 2025

Description of change

Admin CLI requires longer timeout for certain operations.

@oddgrd oddgrd requested a review from jonaro00 January 7, 2025 17:10
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR adds configurable timeout settings to the API client, with a specific focus on extending timeouts for admin CLI operations that require longer processing times.

  • Added 120-second timeout in /admin/src/client.rs for admin operations that may exceed default limits
  • Modified ShuttleApiClient::new() in /api-client/src/lib.rs to accept an optional timeout parameter, defaulting to 60 seconds
  • Implemented timeout configuration through reqwest::Client::builder().timeout() for consistent HTTP client behavior

3 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

admin/src/client.rs Outdated Show resolved Hide resolved
Comment on lines +58 to +59
.build()
.unwrap();
Copy link

Choose a reason for hiding this comment

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

logic: unwrap() could panic if client builder fails. Consider using ? operator or proper error handling here

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This PR extends the timeout configuration implementation by adding CLI argument support and runtime integration.

  • Added client_timeout CLI argument in /admin/src/args.rs with 120-second default
  • Updated runtime initialization in /runtime/src/rt.rs to handle optional timeout parameter
  • Modified admin client constructor in /admin/src/lib.rs to pass through CLI timeout value

4 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

admin/src/args.rs Outdated Show resolved Hide resolved
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

(updates since last review)

This PR continues to refine the API client timeout implementation with a focus on the admin CLI integration. Here's a summary of the latest changes:

  • Added documentation in /admin/src/args.rs to clarify that client_timeout is specified in seconds
  • Integrated timeout configuration in /admin/src/lib.rs through the Client::new() constructor
  • Implemented timeout handling in /api-client/src/lib.rs via reqwest::Client::builder().timeout()

The changes are focused and maintain consistency with the previous implementation while improving clarity around timeout units and configuration.

1 file(s) reviewed, 2 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +19 to +20
#[arg(long, default_value_t = 120)]
pub client_timeout: u64,
Copy link

Choose a reason for hiding this comment

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

style: Consider adding validation to prevent 0 or negative timeout values

Comment on lines +19 to +20
#[arg(long, default_value_t = 120)]
pub client_timeout: u64,
Copy link

Choose a reason for hiding this comment

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

style: 120 seconds may be too short for resource-intensive operations like certificate renewals or mass GC operations

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