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

Ensures poll order wrt subscription ID's #1620

Closed
wants to merge 3 commits into from
Closed

Conversation

pkhry
Copy link
Contributor

@pkhry pkhry commented May 29, 2024

Description

Under current implementation unstable backend will be re-trying to make a call with a fixed amount of attempts instead of backing off on backend reconnection and waiting for newly initialized subscription_id.(see #1567 and comments in the mr referenced there)

The implementation here is adding a .reconnected() method for the backend and a new wrapper function that will poll _.reconnected() and action_being_retried.

So with this new wrapper flowchart will go like this in a loop:

reconnected.next() = None, action = Pending => {
  cancel action;
  return Error(Subscription_droppped)
}
reconnected.next() = Some(true), action = Pending => {
  // Subscription received FollowEvent::Initialized
  loop again to retry the action
}
reconnected.next() = Some(false), action = Pending => {
  // Subscription received FollowEvent::Stop
  loop { 
    reconnected.next() until it returns Some(true)
  }  
  loop again to retry the action
}
reconnected.next() = Pending, action = Ready(result) => {
  try polling the pending `reconnected.next()` and if it is None {
   return result from the action
  } else {
    loop { 
       reconnected.next() until it returns Some(true)
    }
    loop again to retry the action
  }
}

Not sure whether we need to track FollowEvent::Initialized() in reconnected() as code that grabs subscription_id will wait for the new subscription id after being re-run again

closes #1567

@pkhry pkhry requested a review from a team as a code owner May 29, 2024 14:52
@pkhry pkhry marked this pull request as draft May 29, 2024 15:07
@pkhry pkhry marked this pull request as ready for review May 29, 2024 16:24
@pkhry pkhry marked this pull request as draft June 3, 2024 19:55
@pkhry pkhry closed this Sep 11, 2024
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.

reconnecting rpc: ensure poll order to avoid outdated subscription ID on reconnect
1 participant