timeout removed
This commit is contained in:
@@ -2,7 +2,37 @@ const { Sequelize } = require('sequelize');
|
|||||||
|
|
||||||
const sequelize = new Sequelize('miriamgemeinde', 'miriam_user', 'qTCTTWwpEwy3vPDU', {
|
const sequelize = new Sequelize('miriamgemeinde', 'miriam_user', 'qTCTTWwpEwy3vPDU', {
|
||||||
host: 'tsschulz.de',
|
host: 'tsschulz.de',
|
||||||
dialect: 'mysql'
|
dialect: 'mysql',
|
||||||
|
retry: {
|
||||||
|
match: [
|
||||||
|
/ConnectionError/,
|
||||||
|
/SequelizeConnectionError/,
|
||||||
|
/SequelizeConnectionRefusedError/,
|
||||||
|
/SequelizeHostNotFoundError/,
|
||||||
|
/SequelizeHostNotReachableError/,
|
||||||
|
/SequelizeInvalidConnectionError/,
|
||||||
|
/SequelizeConnectionTimedOutError/
|
||||||
|
],
|
||||||
|
max: 5 // Maximal 5 Versuche
|
||||||
|
},
|
||||||
|
pool: {
|
||||||
|
max: 5,
|
||||||
|
min: 0,
|
||||||
|
acquire: 30000,
|
||||||
|
idle: 10000
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
async function connectWithRetry() {
|
||||||
|
try {
|
||||||
|
await sequelize.authenticate();
|
||||||
|
console.log('Connection has been established successfully.');
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Unable to connect to the database:', error);
|
||||||
|
setTimeout(connectWithRetry, 5000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
connectWithRetry();
|
||||||
|
|
||||||
module.exports = sequelize;
|
module.exports = sequelize;
|
||||||
|
|||||||
Reference in New Issue
Block a user