Merge pull request #82 from qzbysh/qzbysh-patch-1

增加MongoDB连接后,检查是否连接成功的验证
This commit is contained in:
vn.py 2016-05-19 23:23:34 +08:00
commit fcce566fe1

View File

@ -208,7 +208,8 @@ class MainEngine(object):
host, port = loadMongoSetting()
try:
self.dbClient = MongoClient(host, port)
self.dbClient = MongoClient(host, port, serverSelectionTimeoutMS=3000)
self.dbClient.server_info()
self.writeLog(u'MongoDB连接成功')
except ConnectionFailure:
self.writeLog(u'MongoDB连接失败')