xjdr/chicago

ChicagoClientTimeout during getNode for non-writeable channel

smarth-madan opened this issue · 1 comments

When a channel is not writeable anymore, the connection is re-established by the client in the following code, but the timeout happens before the connection is re-established.

private ChannelFuture _getNode(String node, long startTime) throws ChicagoClientTimeoutException {
.
.
.
    ChannelFuture cf = connectionMap.get(node);

    if (cf.channel().isWritable()) {
      return cf;
    }

    cf.channel().close();
    cf.cancel(true);
    connectionMap.remove(node);
    log.debug("removing and reconnecting to "+ node);
    connect(new InetSocketAddress(node, 12000), listenerMap.get(node));
    return getNode(node);

  }

FIxed and tested