-
Notifications
You must be signed in to change notification settings - Fork 1
fix: add timeout getMultichainClient to prevent remove connections fr… #73
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
Conversation
src/multichainClient.ts
Outdated
| TransportRequest<M, MultichainApiParams<T, M>>, | ||
| TransportResponse<MultichainApiReturn<T, M>> | ||
| >({ method, params }); | ||
| const res = await withRetry( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't think we want to wrap this in a retry helper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, we do want it but setting retries to 0, so we would only use timeout
EdouardBougon
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to delegate timeout handling to the transport instead?
const transport = getMyCustomTransport({ defaultTimeout: 1500}).
const client = getMultichainClientApi({ transport });In case of a timeout from the transport, we could throw a TransportTimeoutError extending TransportError.
And in withRetry, instead of using a timeout with setTimeout, we just wait for the transport to throw TransportTimeoutError.
And we could also allow overriding the timeout value in the transport.request method.
0e93b41 to
0ad7062
Compare
00b893a to
5102147
Compare
Improve getMultichainClient by adding the requestTimeout property.
This will apply in 2 areas: