If reconnect_in is false, then @retries never gets incremented and hence the on_unbind never gets invoked - the connection just hangs indefinitely. Seems like, in fact, the @retries logic is completely useless: if you specify reconnect then it always reconnects, and if you don't reconnect then you hang forever.
a) drop the retries counter all together
b) use retries counter within the reconnect block to keep track of failed retries.. after which, the on_unbind should be invoked.
https://github.com/bcg/em-mongo/blob/master/lib/em-mongo/connection.rb#L228
If reconnect_in is false, then @retries never gets incremented and hence the on_unbind never gets invoked - the connection just hangs indefinitely. Seems like, in fact, the @retries logic is completely useless: if you specify reconnect then it always reconnects, and if you don't reconnect then you hang forever.
a) drop the retries counter all together b) use retries counter within the reconnect block to keep track of failed retries.. after which, the on_unbind should be invoked.