Class MongoTimeoutConfig
java.lang.Object
edu.ucsb.cs156.courses.config.MongoTimeoutConfig
Limits how long the MongoDB driver waits for a usable server before giving up.
The driver's default is 30 seconds. When MongoDB is unreachable, that makes every request that touches MongoDB hang for 30 seconds before failing, including the health check at /api/actuator/health, which every open browser tab polls once a minute, and which an uptime monitor may give up on before it answers. See docs/healthcheck.md.
When MongoDB is healthy this wait is never used, so a short value costs nothing.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.boot.autoconfigure.mongo.MongoClientSettingsBuilderCustomizermongoServerSelectionTimeout(int seconds)
-
Constructor Details
-
MongoTimeoutConfig
public MongoTimeoutConfig()
-
-
Method Details
-
mongoServerSelectionTimeout
@Bean public org.springframework.boot.autoconfigure.mongo.MongoClientSettingsBuilderCustomizer mongoServerSelectionTimeout(@Value("${app.mongo.serverSelectionTimeoutSeconds:5}") int seconds)
-