- if (ticksSinceProgress >= context.config().getNoProgressTimeout()) {
- LOG.error("Queue {} has not seen progress in {} seconds, failing all requests", this,
- TimeUnit.NANOSECONDS.toSeconds(ticksSinceProgress));
+ if (ticksSinceProgress < context.config().getNoProgressTimeout()) {
+ // Requests are always scheduled in sequence, hence checking for timeout is relatively straightforward.
+ // Note we use also inquire about the delay, so we can re-schedule if needed, hence the unusual
+ // tri-state return convention.
+ final OptionalLong delay = lockedCheckTimeout(now);
+ if (delay == null) {
+ // We have timed out. There is no point in scheduling a timer
+ LOG.debug("{}: connection {} timed out", context.persistenceId(), this);
+ return lockedReconnect(current, new RuntimeRequestException("Backend connection timed out",
+ new TimeoutException()));
+ }