While a ClientConnection is in initial connect state we do not want
the timer to attempt to reconnect it, as it we are already trying
hard to connect it. Suppress that attempt by faking backend silent
ticks to be 0.
Change-Id: Iaf554632a56fd5be1d417d6806462edf3c746526
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
a3b2c1a05f66523561a10ac898723ffdf7e68798)
}
}
+ long backendSilentTicks(final long now) {
+ return now - lastReceivedTicks;
+ }
+
/*
* We are using tri-state return here to indicate one of three conditions:
* - if there is no timeout to schedule, return Optional.empty()
return Optional.empty();
}
- final long backendSilentTicks = now - lastReceivedTicks;
+ final long backendSilentTicks = backendSilentTicks(now);
if (backendSilentTicks >= BACKEND_ALIVE_TIMEOUT_NANOS) {
LOG.debug("Connection {} has not seen activity from backend for {} nanoseconds, timing out", this,
backendSilentTicks);
return Optional.empty();
}
+ @Override
+ long backendSilentTicks(final long now) {
+ // We are still connecting and do not want the timer to attempt a reconnect
+ return 0;
+ }
+
@Override
ClientActorBehavior<T> lockedReconnect(final ClientActorBehavior<T> current, final RequestException cause) {
throw new UnsupportedOperationException("Attempted to reconnect a connecting connection", cause);