Request hang out when mongod service restart
After mongod service restart. Mongoose connection did not catch any event and make every query was hang out (not response result or error). Sometimes it catches and work well but almost not. It seem work well on my laptop MACOS 10.11 (always catch even reconnected ) OR use mongoose v8.3.83
Anyone have idea about this problem and how to fix it ? Thanks.
Nodejs: v4.4.1 Mongoose: v4.4.10 OS GNU/Linux Ubuntu 14.04.3 LTS
// options //"server": { // "socketOptions": { // "keepAlive": 1, // "connectTimeoutMS": 30000 // } //} mongoose.connect(mongo_url, options); var mongo_db = mongoose.connection; mongo_db.on('reconnected', function(){ logger.log("warn", "Mongoose reconnected"); }); mongo_db.once('open', function() { //query data })
Set reconnectTries and reconnectInterval options. Follow #4027 for updates on this