Smaller timeout for MongoStorage connection

By default serverSelectionTimeoutMS=30000. This is too much
This commit is contained in:
Rishat Fayzullin 2024-06-13 10:33:14 +03:00
parent 0df95a0276
commit d88b7ec612

View file

@ -39,7 +39,10 @@ class MongoStorage(BaseStorage):
@classmethod
def from_url(
cls, url: str, connection_kwargs: Optional[Dict[str, Any]] = None, **kwargs: Any
cls,
url: str,
connection_kwargs: Optional[Dict[str, Any]] = {"serverSelectionTimeoutMS": 2000},
**kwargs: Any,
) -> "MongoStorage":
"""
Create an instance of :class:`MongoStorage` with specifying the connection string