File tree 1 file changed +13
-6
lines changed
.suite-cli/cli/scripts/assets
1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -11,12 +11,19 @@ const { subscriber } = require('./src/subscriber');
11
11
const ${ answers . default_broker } = require('${ answers . project_base } /broker/${ answers . default_broker } ');
12
12
// const app = require('./src/app');
13
13
14
- mongoose.connect(config.db).then(() => {
15
- logger.info(\`📀 successfully connected to db: \${config.db}\`);
16
- }).catch(err => {
17
- logger.error(\`failed to connect to db. Exiting... \${err.message}\`);
18
- process.exit(0);
19
- });
14
+ const connectWithRetry = () => {
15
+ mongoose.connect(config.db)
16
+ .then(() => {
17
+ logger.info(\`📀 successfully connected to db: \${config.db}\`);
18
+ })
19
+ .catch((err) => {
20
+ logger.error(\`Failed to connect to db. Exiting... \${err.message}\`);
21
+ logger.info('Retrying connection in 5 seconds...');
22
+ setTimeout(connectWithRetry, 5000); // Retry after 5 seconds
23
+ });
24
+ };
25
+
26
+ connectWithRetry();
20
27
21
28
const app = express();
22
29
You can’t perform that action at this time.
0 commit comments