SHARE
TWEET

Untitled

a guest May 21st, 2019 68 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const mongoURL = Database.URI || process.env.DATABASE_URI as string;
  2.  
  3.  
  4.         const mongoOPTIONS = {
  5.             useNewUrlParser: true,
  6.             autoReconnect: true,
  7.             reconnectTries: Number.MAX_VALUE,
  8.             bufferMaxEntries: 0
  9.         };
  10.  
  11.  
  12.         const connectWithRetry = function() {
  13.  
  14.             return mongoose.connect( mongoURL, mongoOPTIONS, (err) => {
  15.                 if ( err ) {
  16.                     console.error('Failed to connect to mongo on startup - retrying in 5 sec', err );
  17.                     setTimeout(connectWithRetry, 5000);
  18.                 }
  19.             });
  20.  
  21.         };
  22.  
  23.         connectWithRetry();
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top