-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Pulsar Clients: Added a mandatory stop to the Backoff logic #747
Conversation
pulsar-client-cpp/lib/Backoff.cc
Outdated
} | ||
|
||
TimeDuration Backoff::next() { | ||
TimeDuration current = next_; | ||
next_ = std::min(next_ * 2, max_); | ||
|
||
static TimeDuration timeElapsedSinceDisconnection_; |
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.
This is not working:
- Backoff has no notion of disconnection.. it's just a simple class to deal with exponential backoff
static
here is messing up across differentBackoff
instances. Each connection is having its own instance.
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.
Rookie Mistake :-(
retest this please |
ff3fb5b
to
c4b321f
Compare
pulsar-client-cpp/lib/Backoff.h
Outdated
TimeDuration mandatoryStop_; | ||
TimeDuration timeElapsedSinceDisconnection_; | ||
bool mandatoryStopMade_; | ||
unsigned int seed_; |
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.
Rename to randomSeed_
?
pulsar-client-cpp/lib/Backoff.cc
Outdated
current = std::max(initial_, mandatoryStop_ - timeElapsedSinceDisconnection_); | ||
mandatoryStopMade_ = true; | ||
} | ||
timeElapsedSinceDisconnection_ += current; |
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.
Given that the exact current time might be slightly different than the "sleep" time, I think we should be better use an absolute time instead of timeElapsedSinceDisconnection_
. That will be resistent to the multiple timeout being scheduled.
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.
👍
retest this please |
1 similar comment
retest this please |
#745