Connection Reset By Peer Pymongo
I have some documents which I have to fetch from mongodb and set it to memcache. Here is the code import memcache from pymongo import MongoClient db = mongo_client.job_db.JobParse
Solution 1:
According to the information below for the issue from the pymongo
api document here, the exception need to be handled manually.
exception pymongo.errors.AutoReconnect(message='', errors=None)
Raised when a connection to the database is lost and an attempt to auto-reconnect will be made.
In order to auto-reconnect you must handle this exception, recognizing that the operation which caused it has not necessarily succeeded. Future operations will attempt to open a new connection to the database (and will continue to raise this exception until the first successful connection is made).
I searched some existing solution for the issue, please see below.
- A code snippet from here for gracefully handling the PyMongo
AutoReconnect
exception. - Using a middleware named
MongoDBProxy
to automatically handleAutoReconnect
exception.
Hope it helps.
Post a Comment for "Connection Reset By Peer Pymongo"