We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f65d8f5 commit 6457073Copy full SHA for 6457073
lib/models/mongo/mongoose-control.js
@@ -52,6 +52,19 @@ mongooseControl.start = function (cb) {
52
}
53
54
mongoose.connect(process.env.MONGO, mongooseOptions, cb)
55
+ mongoose.connection.on('disconnected', function () {
56
+ if (!mongoose.connection._hasOpened) {
57
+ log.fatal({message: 'Failed to connect to ' + process.env.MONGO}, 'failed to establish a connection to mongodb')
58
+ process.exit(1)
59
+ } else {
60
+ log.error({message: 'Lost connection to ' + process.env.MONGO})
61
+ setTimeout(function () {
62
+ if (!mongoose.connection.readyState) {
63
64
+ }
65
+ }, 10000)
66
67
+ })
68
69
70
mongooseControl.stop = function (cb) {
0 commit comments