bcg / em-mongo

EventMachine MongoDB Driver (based off of RMongo)
http://github.com/bcg/em-mongo
141 stars 47 forks source link

on_unbind callback never gets invoked #22

Closed igrigorik closed 13 years ago

igrigorik commented 13 years ago

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.

bcg commented 13 years ago

Just pushed the 0.3.6 gem