Merge pull request #82 from qzbysh/qzbysh-patch-1
增加MongoDB连接后,检查是否连接成功的验证
This commit is contained in:
commit
fcce566fe1
@ -208,7 +208,8 @@ class MainEngine(object):
|
|||||||
host, port = loadMongoSetting()
|
host, port = loadMongoSetting()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.dbClient = MongoClient(host, port)
|
self.dbClient = MongoClient(host, port, serverSelectionTimeoutMS=3000)
|
||||||
|
self.dbClient.server_info()
|
||||||
self.writeLog(u'MongoDB连接成功')
|
self.writeLog(u'MongoDB连接成功')
|
||||||
except ConnectionFailure:
|
except ConnectionFailure:
|
||||||
self.writeLog(u'MongoDB连接失败')
|
self.writeLog(u'MongoDB连接失败')
|
||||||
|
Loading…
Reference in New Issue
Block a user