Skip to content

Conversation

@elribonazo
Copy link
Contributor

Improve getMultichainClient by adding the requestTimeout property.

This will apply in 2 areas:

  1. ensureInitialized will now have the ability to wait for extra time (allowing remote connections to establish)
  2. on each request, createSession, getSession, revokeSession and invokeMethod, it will also wait for extra time before dropping the connection rather than waiting forever

@elribonazo elribonazo requested a review from a team as a code owner September 17, 2025 09:01
TransportRequest<M, MultichainApiParams<T, M>>,
TransportResponse<MultichainApiReturn<T, M>>
>({ method, params });
const res = await withRetry(
Copy link
Contributor

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

Copy link
Contributor Author

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

Copy link
Contributor

@EdouardBougon EdouardBougon left a 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.

cursor[bot]

This comment was marked as outdated.

EdouardBougon
EdouardBougon previously approved these changes Sep 22, 2025
cursor[bot]

This comment was marked as outdated.

@EdouardBougon EdouardBougon force-pushed the features/configure_timeouts branch from 00b893a to 5102147 Compare September 23, 2025 10:39
@EdouardBougon EdouardBougon merged commit 6a43768 into main Sep 23, 2025
22 checks passed
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.

5 participants