Skip to content

Commit 4f29615

Browse files
authored
Merge pull request #221 from LuckierDodge/main
fix: Lower the connection timeout on pymongo client to reduce startup lag.
2 parents 897f28c + e41ecc4 commit 4f29615

File tree

1 file changed

+2
-2
lines changed
  • src/pytest_mock_resources/container

1 file changed

+2
-2
lines changed

src/pytest_mock_resources/container/mongo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ def ports(self):
4040

4141
def check_fn(self):
4242
try:
43-
client = pymongo.MongoClient(self.host, self.port)
43+
client = pymongo.MongoClient(self.host, self.port, timeoutMS=1000)
4444
db = client[self.root_database]
4545
db.command("ismaster")
46-
except pymongo.errors.ConnectionFailure:
46+
except pymongo.errors.PyMongoError:
4747
raise ContainerCheckFailed(
4848
f"Unable to connect to a presumed MongoDB test container via given config: {self}"
4949
)

0 commit comments

Comments
 (0)