linnovate / meanio

meanio core module
MIT License
54 stars 73 forks source link

Implement a retry capability when connecting to MongoDB #67

Open dazwin opened 9 years ago

dazwin commented 9 years ago

This allows configuration of a retry loop when connecting to Mongo. You can configure as follows:

module.exports = {
  db: 'mongodb://' + (process.env.DB_PORT_27017_TCP_ADDR || 'localhost') + '/mean-dev',
  dbOptions: {
    retry: {
      times: 5,
      interval: 1000
    }
  },
  ...

Options are per async.retry (interval is in ms). Default behavior is to not retry (i.e. current behavior).

timelf123 commented 8 years ago

This is a nice addition, thanks!