![]() ![]() While 30 seconds seems like a long time, serverSelectionTimeoutMS means you're unlikely to see any interruptions during a replica set failover. Similarly, if your standalone MongoDB server goes down after initial connection, any find() or save() calls will error out after 30 seconds, unless your MongoDB server is restarted. Throws an error "getaddrinfo ENOTFOUND doesnt.exist" after 30 seconds await mongoose. This means that, for example, if you call nnect() when your standalone MongoDB server is down, your nnect() call will only throw an error after 30 seconds. This includes initial connection, like await nnect(), as well as any operations that make requests to MongoDB, like save() or find().īy default, serverSelectionTimeoutMS is 30000 (30 seconds). The serverSelectionTimeoutMS option is extremely important: it controls how long the MongoDB Node.js driver will attempt to retry any operation before erroring out. We recommend you do not set this setting below 1000, too many heartbeats can lead to performance degradation. ![]() Mongoose only emits a 'disconnected' event after a heartbeat has failed, so you may want to decrease this setting to reduce the time between when your server goes down and when Mongoose emits 'disconnected'. A heartbeat is subject to serverSelectionTimeoutMS, so the MongoDB driver will retry failed heartbeats for up to 30 seconds by default.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |