Hi
when doing pytest -m connection_pooling
Code:
def get_db():
“”"
Configuration method to return db instance
“”"
db = getattr(g, “_database”, None)
MFLIX_DB_URI = current_app.config[“MFLIX_DB_URI”]
if db is None:
"""
Ticket: Connection Pooling
Please change the configuration of the MongoClient object by setting the
maximum connection pool size to 50 active connections.
"""
"""
Ticket: Timeouts
Please prevent the program from waiting indefinitely by setting the
write concern timeout limit to 2500 milliseconds.
"""
db = g._database = MongoClient(
MFLIX_DB_URI,
# TODO: Connection Pooling
# Set the maximum connection pool size to 50 active connections.
# TODO: Timeouts
# Set the write timeout limit to 2500 milliseconds.
maxPoolSize=50
)["mflix"]
return db