@ntalmagor/3drise-common 1.0.19 → 1.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/build/database.js +29 -10
  2. package/package.json +1 -1
package/build/database.js CHANGED
@@ -6,27 +6,46 @@ let _sequelize = null;
6
6
  function getSequelize() {
7
7
  if (!_sequelize) {
8
8
  _sequelize = new sequelize_typescript_1.Sequelize({
9
- database: process.env.RISE_MYSQL_DATABASE,
10
9
  dialect: 'mysql',
10
+ database: process.env.RISE_MYSQL_DATABASE,
11
11
  host: process.env.MYSQL_HOST,
12
12
  username: process.env.RISE_MYSQL_USER,
13
13
  password: process.env.RISE_MYSQL_PASSWORD,
14
14
  port: parseInt(process.env.MYSQL_PORT || '3306'),
15
15
  models: [],
16
16
  logging: false,
17
- // logging: process.env.NODE_ENV === 'production' ? false : console.log,
18
- pool: {
19
- max: 10,
20
- min: 0,
21
- acquire: 30000,
22
- idle: 10000,
17
+ define: {
18
+ timestamps: true,
19
+ underscored: false,
23
20
  },
24
21
  dialectOptions: {
25
- connectTimeout: 60000
22
+ connectTimeout: 120000, // 2 min for the initial TCP connect
23
+ },
24
+ pool: {
25
+ max: 15,
26
+ min: 0,
27
+ acquire: 120000, // 2 min to acquire a connection from the pool
28
+ idle: 30000, // close idle conns after 30s
29
+ evict: 5000, // sweep the pool every 5s
26
30
  },
27
31
  retry: {
28
- max: 3
29
- }
32
+ max: 5,
33
+ backoffBase: 1000, // 1s, doubles each retry (effectively)
34
+ backoffExponent: 1.5,
35
+ match: [
36
+ /ETIMEDOUT/,
37
+ /ECONNREFUSED/,
38
+ /ECONNRESET/,
39
+ /EAI_AGAIN/,
40
+ /PROTOCOL_CONNECTION_LOST/,
41
+ /SequelizeConnectionError/,
42
+ /SequelizeConnectionRefusedError/,
43
+ /SequelizeHostNotFoundError/,
44
+ /SequelizeHostNotReachableError/,
45
+ /SequelizeConnectionTimedOutError/,
46
+ /SequelizeConnectionAcquireTimeoutError/,
47
+ ],
48
+ },
30
49
  });
31
50
  }
32
51
  return _sequelize;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ntalmagor/3drise-common",
3
- "version": "1.0.19",
3
+ "version": "1.0.21",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",