You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by gi...@git.apache.org on 2017/09/08 04:13:35 UTC

[GitHub] merlimat commented on a change in pull request #747: CPP Client: Add a mandatory stop to the Backoff logic

merlimat commented on a change in pull request #747: CPP Client: Add a mandatory stop to the Backoff logic
URL: https://github.com/apache/incubator-pulsar/pull/747#discussion_r137706116
 
 

 ##########
 File path: pulsar-client-cpp/lib/Backoff.cc
 ##########
 @@ -21,20 +21,34 @@
 
 namespace pulsar {
 
-Backoff::Backoff(const TimeDuration& initial, const TimeDuration& max)
+Backoff::Backoff(const TimeDuration& initial, const TimeDuration& max, const TimeDuration& mandatoryStop)
         : initial_(initial),
           max_(max),
-          next_(initial) {
+          next_(initial),
+          mandatoryStopMade_(false),
+          mandatoryStop_(mandatoryStop) {
 }
 
 TimeDuration Backoff::next() {
     TimeDuration current = next_;
     next_ = std::min(next_ * 2, max_);
+
+    static TimeDuration timeElapsedSinceDisconnection_;
 
 Review comment:
   This is not working: 
    1. Backoff has no notion of disconnection.. it's just a simple class to deal with exponential backoff
    2. `static` here is messing up across different `Backoff` instances. Each connection is having its own instance.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services