@ikonintegration/ikapi 2.6.6 → 2.6.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ikonintegration/ikapi",
3
- "version": "2.6.6",
3
+ "version": "2.6.9",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "module": "main.js",
@@ -123,12 +123,19 @@ export default class IKCache_Redis extends IKCache {
123
123
  //redis v4 & v3 compatibility
124
124
  if (connection && connection.connect) await connection.connect();
125
125
  //
126
- connection.on('connect', () => {
126
+ const connectedHandler = () => {
127
127
  this.connection = connection;
128
128
  if (this.awaitingConnectionQueue) this.awaitingConnectionQueue.forEach((resolve) => resolve());
129
129
  this.awaitingConnectionQueue = null;
130
130
  resolve();
131
- });
131
+ }
132
+ //reached here on v4, everything is connected
133
+ if (isV4) {
134
+ connectedHandler();
135
+ return;
136
+ }
137
+ //v3 <=
138
+ connection.on('connect', connectedHandler);
132
139
  connection.on('error', (err) => {
133
140
  localConsole.error(err);
134
141
  if (this.awaitingConnectionQueue) this.awaitingConnectionQueue.forEach((resolve) => resolve()); //fulfill, error will be thrown