Strip additional hosts in the connection string
This commit is contained in:
@@ -30,6 +30,14 @@ class Connection:
|
|||||||
connection = cls()
|
connection = cls()
|
||||||
|
|
||||||
connection.host = host
|
connection.host = host
|
||||||
|
|
||||||
|
# strip any additional hosts in the connection string for now
|
||||||
|
try:
|
||||||
|
if "," in port:
|
||||||
|
port = port[:port.find(',')]
|
||||||
|
except TypeError:
|
||||||
|
pass
|
||||||
|
|
||||||
connection.port = port
|
connection.port = port
|
||||||
connection._loop = loop
|
connection._loop = loop
|
||||||
connection._retry_interval = .5
|
connection._retry_interval = .5
|
||||||
|
|||||||
@@ -39,6 +39,14 @@ class TestMongoConnectionMethods(MongoTest):
|
|||||||
pool = asyncio_mongo.Pool.create(mongo_host, mongo_port, poolsize=2)
|
pool = asyncio_mongo.Pool.create(mongo_host, mongo_port, poolsize=2)
|
||||||
self.assertTrue(inspect.isgenerator(pool))
|
self.assertTrue(inspect.isgenerator(pool))
|
||||||
rapi = yield from pool
|
rapi = yield from pool
|
||||||
print('rapi %s' % rapi.__class__)
|
self.assertEqual(isinstance(rapi, asyncio_mongo.Pool), True)
|
||||||
|
rapi.close()
|
||||||
|
|
||||||
|
@async
|
||||||
|
def test_pool(self):
|
||||||
|
# MongoConnectionPool returns deferred, which gets MongoAPI
|
||||||
|
pool = asyncio_mongo.Pool.create(mongo_host, "%s,blah:333" % mongo_port, poolsize=2)
|
||||||
|
self.assertTrue(inspect.isgenerator(pool))
|
||||||
|
rapi = yield from pool
|
||||||
self.assertEqual(isinstance(rapi, asyncio_mongo.Pool), True)
|
self.assertEqual(isinstance(rapi, asyncio_mongo.Pool), True)
|
||||||
rapi.close()
|
rapi.close()
|
||||||
Reference in New Issue
Block a user