mongoose icon indicating copy to clipboard operation
mongoose copied to clipboard

Request hang out when mongod service restart

Open cong88 opened this issue 10 years ago • 1 comments

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 })

cong88 avatar Mar 31 '16 03:03 cong88

Set reconnectTries and reconnectInterval options. Follow #4027 for updates on this

vkarpov15 avatar Apr 03 '16 14:04 vkarpov15