Skip to content

Commit 3119d36

Browse files
committed
Pass through timeout arguments for the client
Signed-off-by: Mathias L. Baumann <[email protected]>
1 parent 7510149 commit 3119d36

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/frequenz/dispatch/_dispatcher.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,23 +198,33 @@ async def run():
198198
```
199199
"""
200200

201+
# pylint: disable-next=too-many-arguments
201202
def __init__(
202203
self,
203204
*,
204205
microgrid_id: int,
205206
server_url: str,
206207
key: str,
208+
call_timeout: timedelta = timedelta(seconds=60),
209+
stream_timeout: timedelta = timedelta(minutes=5),
207210
):
208211
"""Initialize the dispatcher.
209212
210213
Args:
211214
microgrid_id: The microgrid id.
212215
server_url: The URL of the dispatch service.
213216
key: The key to access the service.
217+
call_timeout: The timeout for API calls.
218+
stream_timeout: The timeout for streaming API calls.
214219
"""
215220
super().__init__()
216221

217-
self._client = DispatchApiClient(server_url=server_url, key=key)
222+
self._client = DispatchApiClient(
223+
server_url=server_url,
224+
key=key,
225+
call_timeout=call_timeout,
226+
stream_timeout=stream_timeout,
227+
)
218228
self._bg_service = DispatchScheduler(
219229
microgrid_id,
220230
self._client,

0 commit comments

Comments
 (0)