Open rubenbonilla opened 8 years ago
I was doing a debug on the library. I'm pretty sure that the bug is happening on connection.py file on line 100.
try:
if not _connections[alias].connected:
_connections[alias].open_sync()
except Exception:
exc_info = sys.exc_info()
err = ConnectionError("Cannot connect to database %s :\n%s" % (alias, exc_info[1]))
raise six.reraise(ConnectionError, err, exc_info[2])
When if not _connections[alias].connected
is asked it always returns a dict with data like: MotorDatabase(Database(MongoClient([]), u'connected'))
so always is gonna be true, always connected, never raises an error so you can't handled when the connection is lost.
Python:
Libraries:
I'm doing some tests with this library and something that i can't handle is when i'm trying to do any request to MongoDB when it's down.
This warning is shown on the console: [W 160714 09:55:26 iostream:1186] Connect error on fd 14: ECONNREFUSED
When this message appears in a few seconds the RAM is overloaded blocking the computer and i just must wait to try to kill the process.
Im triying to handle this when i instanciate the connection:
and also in the callback when i create a document:
I just want to be sure if in some case the connection is lost i will get a feedback for just send some error messge in my service.