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

call_and_wait should add a delay between calls to request_status_raw #119

Open
p-shahi opened this issue Mar 2, 2021 · 1 comment
Open

Comments

@p-shahi
Copy link
Contributor

p-shahi commented Mar 2, 2021

        loop {
            match self.agent.request_status_raw(&request_id).await? {
…
                RequestStatusResponse::Unknown => (),
                RequestStatusResponse::Received | RequestStatusResponse::Processing => {
                    // The system will return Unknown until the request is accepted
                    // and we generally cannot know how long that will take.
                    // State transitions between Received and Processing may be
                    // instantaneous. Therefore, once we know the request is accepted,
                    // we restart the waiter so the request does not time out.
                    if !request_accepted {
                        waiter
                            .restart()
                            .map_err(|_| AgentError::WaiterRestartError())?;
                        request_accepted = true;
                    }
                }
…
            };

will very aggressively hammer the read endpoint, possibly starving that node. [There should be some delays here.]

@hansl
Copy link
Contributor

hansl commented Apr 6, 2021

It seems we are using the Waiter to throttle. Are you using the proper Waiter instance?

https://github.com/dfinity/agent-rs/blob/next/ic-agent/src/agent/mod.rs#L603-L605

            waiter
                .wait()
                .map_err(|_| AgentError::TimeoutWaitingForResponse())?;

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

No branches or pull requests

2 participants