@mimik/rediser 1.4.10 → 1.4.12

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/index.js +10 -6
  2. package/package.json +12 -12
package/index.js CHANGED
@@ -15,7 +15,8 @@ const VALIDATION_CHECK = 100; // in ms
15
15
  const CONNECTED = 1;
16
16
  const DISCONNECTED = 2;
17
17
 
18
- let display = true;
18
+ let displayCreate = true;
19
+ let displayDisconnect = true;
19
20
  let state = DISCONNECTED;
20
21
 
21
22
  module.exports = (set, config) => {
@@ -31,8 +32,10 @@ module.exports = (set, config) => {
31
32
  */
32
33
  const initializeSync = () => {
33
34
  if (set !== 'on') {
34
- if (display) logger.info('cache not enabled', { type }, correlationId);
35
- display = false;
35
+ if (displayCreate) {
36
+ logger.info('cache not enabled', { type }, correlationId);
37
+ displayCreate = false;
38
+ }
36
39
  return null;
37
40
  }
38
41
  let interval;
@@ -41,12 +44,12 @@ module.exports = (set, config) => {
41
44
  if (!interval) {
42
45
  interval = setInterval(() => {
43
46
  if (state !== CONNECTED) {
44
- if (display) {
47
+ if (displayDisconnect) {
45
48
  logger.error('fatal error: Timeout in connecting to cache', {
46
49
  type, error: state, timeout: redisSettings.connectTimeout,
47
50
  }, correlationId);
51
+ displayDisconnect = false;
48
52
  }
49
- display = false;
50
53
  logger.flushAndExit(1);
51
54
  }
52
55
  else {
@@ -57,7 +60,7 @@ module.exports = (set, config) => {
57
60
  }
58
61
  };
59
62
 
60
- if (display) {
63
+ if (displayCreate) {
61
64
  if (isProd(config.nodeEnvironment)) {
62
65
  const redisSettingsClone = { ...redisSettings };
63
66
 
@@ -65,6 +68,7 @@ module.exports = (set, config) => {
65
68
  logger.info('creating a cache connection', { type, settings: redisSettingsClone }, correlationId);
66
69
  }
67
70
  else logger.info('creating a cache connection', { type, settings: redisSettings }, correlationId);
71
+ displayCreate = false;
68
72
  }
69
73
  const client = redis.createClient(redisSettings.url, redisSettings.options);
70
74
  client.connect();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mimik/rediser",
3
- "version": "1.4.10",
3
+ "version": "1.4.12",
4
4
  "description": "Helper for setting up redis using redis for mimik microservices",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -29,21 +29,21 @@
29
29
  "url": "https://bitbucket.org/mimiktech/rediser"
30
30
  },
31
31
  "dependencies": {
32
- "@mimik/lib-filters": "^1.4.4",
33
- "@mimik/sumologic-winston-logger": "^1.6.8",
32
+ "@mimik/lib-filters": "^1.4.5",
33
+ "@mimik/sumologic-winston-logger": "^1.6.11",
34
34
  "bluebird": "3.7.2",
35
- "redis": "4.1.0"
35
+ "redis": "4.5.1"
36
36
  },
37
37
  "devDependencies": {
38
- "@mimik/eslint-plugin-dependencies": "^2.4.3",
39
- "@mimik/eslint-plugin-document-env": "^1.0.3",
40
- "eslint": "8.15.0",
38
+ "@mimik/eslint-plugin-dependencies": "^2.4.4",
39
+ "@mimik/eslint-plugin-document-env": "^1.0.4",
40
+ "eslint": "8.28.0",
41
41
  "eslint-config-airbnb": "19.0.4",
42
42
  "eslint-plugin-import": "2.26.0",
43
- "eslint-plugin-jsx-a11y": "6.5.1",
44
- "eslint-plugin-react": "7.29.4",
45
- "eslint-plugin-react-hooks": "4.5.0",
46
- "husky": "8.0.1",
47
- "jsdoc-to-markdown": "7.1.1"
43
+ "eslint-plugin-jsx-a11y": "6.6.1",
44
+ "eslint-plugin-react": "7.31.11",
45
+ "eslint-plugin-react-hooks": "4.6.0",
46
+ "husky": "8.0.2",
47
+ "jsdoc-to-markdown": "8.0.0"
48
48
  }
49
49
  }