Skip to content

Remove client retries and move more code to envio package - #329

Merged
JonoPrest merged 5 commits into
mainfrom
jp/remove-client-retries
Nov 8, 2024
Merged

Remove client retries and move more code to envio package#329
JonoPrest merged 5 commits into
mainfrom
jp/remove-client-retries

Conversation

@JonoPrest

Copy link
Copy Markdown
Collaborator

No description provided.

@JonoPrest
JonoPrest requested a review from DZakh November 8, 2024 15:27
Comment on lines +426 to +433

let make = (~url, ~bearerToken: option<string>, ~httpReqTimeoutMillis, ~maxNumRetries) =>
new({
url,
enableChecksumAddresses: true,
bearerToken: Env.envioApiToken->Belt.Option.getWithDefault(defaultToken),
httpReqTimeoutMillis: Env.hyperSyncClientTimeoutMillis->Belt.Option.getWithDefault(120_000),
bearerToken: bearerToken->Belt.Option.getWithDefault(defaultToken),
httpReqTimeoutMillis,
maxNumRetries,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The constructor of HyperSyncClient now takes arguments explicitly

Comment on lines +85 to +90
let newClient = HyperSyncClient.make(
~url,
~bearerToken=Env.envioApiToken,
~maxNumRetries=Env.hyperSyncClientMaxRetries,
~httpReqTimeoutMillis=Env.hyperSyncClientTimeoutMillis,
)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

client instantiated with the environment variables.

Comment on lines +32 to +37
/**
This is the number of retries that the binary client makes before rejecting the promise with an error
Default is 0 so that the indexer can handle retries internally
*/
let hyperSyncClientMaxRetries =
envSafe->EnvSafe.get("ENVIO_HYPERSYNC_CLIENT_MAX_RETRIES", S.int, ~fallback=0)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The client by default sets this to 12, I want to avoid all retries by the client so we can get the error response and handle the retry on the indexer. That way trace of where it could freeze would be more explicit

@JonoPrest
JonoPrest force-pushed the jp/remove-client-retries branch from 0b58019 to 5672f9f Compare November 8, 2024 16:01
@JonoPrest
JonoPrest force-pushed the jp/remove-client-retries branch from 5672f9f to ff021ed Compare November 8, 2024 16:16

@DZakh DZakh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 🚀

@JonoPrest
JonoPrest merged commit 61130d9 into main Nov 8, 2024
@JonoPrest
JonoPrest deleted the jp/remove-client-retries branch November 8, 2024 16:32
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.

2 participants