ac-bootstrap-bull 1.0.13 → 2.0.0

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 (3) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/index.js +17 -5
  3. package/package.json +5 -5
package/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ <a name="2.0.0"></a>
2
+
3
+ # [2.0.0](https://github.com/admiralcloud/ac-bootstrap-bull/compare/v1.0.14..v2.0.0) (2023-02-19 15:28:13)
4
+
5
+
6
+ ### Bug Fix
7
+
8
+ * **App:** Package updates | MP | [6cc3d951bd24470b59e94e5721cc90996accbbf4](https://github.com/admiralcloud/ac-bootstrap-bull/commit/6cc3d951bd24470b59e94e5721cc90996accbbf4)
9
+ Package updates
10
+ Related issues: [undefined/undefined#master](undefined/browse/master)
11
+ ## BREAKING CHANGES
12
+ * **App:** Node 16+ required
13
+ <a name="1.0.14"></a>
14
+
15
+ ## [1.0.14](https://github.com/admiralcloud/ac-bootstrap-bull/compare/v1.0.13..v1.0.14) (2023-01-28 18:43:55)
16
+
17
+
18
+ ### Bug Fix
19
+
20
+ * **App:** Fixed error handling | MP | [acbaad1bbbe881bba5f61ffe54cd1df3952dc78b](https://github.com/admiralcloud/ac-bootstrap-bull/commit/acbaad1bbbe881bba5f61ffe54cd1df3952dc78b)
21
+ Improved retry strategy and improved error handling for Redis clients
22
+ Related issues: [undefined/undefined#master](undefined/browse/master)
1
23
  <a name="1.0.13"></a>
2
24
 
3
25
  ## [1.0.13](https://github.com/admiralcloud/ac-bootstrap-bull/compare/v1.0.12..v1.0.13) (2023-01-28 17:59:43)
package/index.js CHANGED
@@ -43,8 +43,9 @@ module.exports = function(acapi) {
43
43
  port: _.get(redisServer, 'port', 6379),
44
44
  db: _.get(redisConfig, 'db', 3),
45
45
  retryStrategy: (times) => {
46
- const delay = Math.min(Math.pow(2, times) * 1000, 300000)
47
- return delay
46
+ const retryArray = [1,2,2,5,5,5,10,10,10,10,15]
47
+ const delay = times < retryArray.length ? retryArray[times] : retryArray.at(retryArray.length)
48
+ return delay*1000
48
49
  },
49
50
  enableReadyCheck: false,
50
51
  maxRetriesPerRequest: null,
@@ -59,15 +60,26 @@ module.exports = function(acapi) {
59
60
 
60
61
  acapi.aclog.serverInfo(redisConf)
61
62
 
63
+ const createRedisClient = ({ config, type }) => {
64
+ const client = new Redis(config)
65
+ client.on('error', (err) => {
66
+ acapi.log.error('BULL/REDIS | Problem | %s | %s', type.padEnd(25), _.get(err, 'message'))
67
+ })
68
+ client.on('ready', () => {
69
+ acapi.log.info('BULL/REDIS | Ready | %s', type)
70
+ })
71
+ return client
72
+ }
73
+
62
74
  const opts = {
63
75
  createClient: (type) => {
64
76
  switch (type) {
65
77
  case 'client':
66
- return new Redis(redisConf)
78
+ return createRedisClient({ config: redisConf, type })
67
79
  case 'subscriber':
68
- return new Redis(redisConf)
80
+ return createRedisClient({ config: redisConf, type })
69
81
  default:
70
- return new Redis(redisConf)
82
+ return createRedisClient({ config: redisConf, type: 'default' })
71
83
  }
72
84
  }
73
85
  }
package/package.json CHANGED
@@ -1,18 +1,18 @@
1
1
  {
2
2
  "name": "ac-bootstrap-bull",
3
- "version": "1.0.13",
3
+ "version": "2.0.0",
4
4
  "description": "Bull helper",
5
5
  "repository": "admiralcloud/ac-bootstrap-bull",
6
6
  "author": "Mark Poepping <mark.poepping@admiralcloud.com>",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "ac-redislock": "^2.0.1",
9
+ "ac-redislock": "^3.0.0",
10
10
  "async": "^3.2.4",
11
- "bull": "^4.10.2",
12
- "ioredis": "^5.3.0",
11
+ "bull": "^4.10.4",
12
+ "ioredis": "^5.3.1",
13
13
  "lodash": "^4.17.21"
14
14
  },
15
15
  "devDependencies": {
16
- "eslint": "^8.32.0"
16
+ "eslint": "^8.34.0"
17
17
  }
18
18
  }