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

Timeout member added to ehrclient class #89

Merged
merged 16 commits into from
Oct 25, 2024
Merged
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions healthchain/clients/ehrclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ def wrapper(self, *args: Any, **kwargs: Any) -> EHRClient:

class EHRClient(BaseClient):
def __init__(
self, func: Callable[..., Any], workflow: Workflow, strategy: BaseStrategy
self,
func: Callable[..., Any],
workflow: Workflow,
strategy: BaseStrategy,
timeout: Optional[float] = 10.0,
):
"""
Initializes the EHRClient with a data generator function and optional workflow and use case.
Expand All @@ -117,6 +121,7 @@ def __init__(
self.strategy: BaseStrategy = strategy
self.vendor = None
self.request_data: List[CDSRequest] = []
self.timeout = timeout

def set_vendor(self, name) -> None:
self.vendor = name
Expand Down Expand Up @@ -150,7 +155,7 @@ async def send_request(self, url: str) -> List[Dict]:
async with httpx.AsyncClient() as client:
responses: List[Dict] = []
# TODO: pass timeout as config
timeout = httpx.Timeout(10.0, read=None)
timeout = httpx.Timeout(self.timeout, read=None)
for request in self.request_data:
try:
if self.strategy.api_protocol == ApiProtocol.soap:
Expand Down
Loading