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

Pass timeout as configuration in EHRClient #67

Open
jenniferjiangkells opened this issue Sep 30, 2024 · 2 comments
Open

Pass timeout as configuration in EHRClient #67

jenniferjiangkells opened this issue Sep 30, 2024 · 2 comments
Labels
Component: Sandbox Issue/PRs that deal with the client and server components of the sandbox good first issue Good for newcomers hacktoberfest Issues suitable for hacktoberfest

Comments

@jenniferjiangkells
Copy link
Member

Description

In the EHRClient.send_request method, we currently have a hardcoded timeout value. We need to modify this to accept a configurable timeout value.

timeout = httpx.Timeout(10.0, read=None)

Context

This change is important because different environments and use cases may require different timeout settings. For example, in development, we might want a longer timeout for debugging, while in production, we might need stricter timeouts. Making this configurable will benefit other users by allowing them to fine-tune the client's behavior to their specific needs without modifying the core code.

Possible Implementation

  1. Add a timeout parameter to the EHRClient constructor with a default value:

    def __init__(self, ..., timeout: Optional[float] = 10.0):
        self.timeout = timeout
  2. Update the send_request method to use the configured timeout:

    timeout = httpx.Timeout(self.timeout, read=None)
  3. Update docstrings and type hints accordingly.

  4. Modify existing tests and add new ones to cover the timeout configuration.

Possible Alternatives

  1. Instead of a simple float, we could use a more complex timeout configuration object that allows setting connect, read, and write timeouts separately.

  2. We could implement a global configuration system for the entire library, where timeout would be just one of many configurable options.

  3. We could use environment variables for configuration, allowing users to set timeouts without changing code.

@jenniferjiangkells jenniferjiangkells added good first issue Good for newcomers hacktoberfest Issues suitable for hacktoberfest Component: Sandbox Issue/PRs that deal with the client and server components of the sandbox labels Sep 30, 2024
@rafabelts
Copy link

Hi, I would like to work in the issue

@jenniferjiangkells
Copy link
Member Author

@rafabelts Thanks for your interest in contributing! I will unassign you for now as we've decided not to assign issues but please feel free to still work on it - let us know if you start working on it and just open a PR when you're ready 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Sandbox Issue/PRs that deal with the client and server components of the sandbox good first issue Good for newcomers hacktoberfest Issues suitable for hacktoberfest
Projects
Status: Todo
Development

No branches or pull requests

2 participants