Good catch.

On Saturday, December 21, 2013, Matt Reiferson wrote:

> In lib/readerrdy.coffee:
>
> > +        connectionRdy.bump()
> > +
> > +  removeConnection: (conn) ->
> > +    @connections.splice @connections.indexOf(conn), 1
> > +    @roundRobinConnections.remove conn
> > +
> > +    if @connections.length is 0
> > +      @goto 'ZERO'
> > +
> > +  bump: ->
> > +    # RDY 1 to each connection to test the waters.
> > +    for conn in @connections
> > +      conn.bump()
> > +
> > +  try: ->
> > +    @connections[0].bump()
>
> This is executed at the end of the backoff timeout...
>
> It doesn't seem safe to assume that there will be non-zero connections at
> that point, and I don't see anything that cleans up this timed callback if
> all connections close.
>
> Also, why hard-code the 0th connection? Is there an assumption that
> balance will always run and redistribute? Do you think that favors the 0thconnection for the first balance interval?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/dudleycarr/nsqjs/pull/5/files#r8518057>
> .
>