@tiledesk/tiledesk-tybot-connector 0.2.138-rc3 → 0.2.138-rc5

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/TdCache.js +23 -8
  2. package/package.json +1 -1
package/TdCache.js CHANGED
@@ -15,12 +15,14 @@ class TdCache {
15
15
  }
16
16
 
17
17
  async connect(callback) {
18
- // client = redis.createClient();
18
+
19
19
  return new Promise( async (resolve, reject) => {
20
+ /**
21
+ * Connect redis client
22
+ */
20
23
  this.client = redis.createClient(
21
24
  {
22
- host: this.redis_host,
23
- port: this.redis_port,
25
+ url: `redis://${this.redis_host}:${this.redis_port}`,
24
26
  password: this.redis_password
25
27
  });
26
28
  this.client.on('error', err => {
@@ -34,16 +36,29 @@ class TdCache {
34
36
  if (callback) {
35
37
  callback();
36
38
  }
37
- //console.log("Redis is ready.");
38
39
  });
39
40
  await this.client.connect();
41
+
42
+ /**
43
+ * Connect redis subscription client
44
+ */
40
45
  this.redis_sub = redis.createClient(
41
46
  {
42
- host: this.redis_host,
43
- port: this.redis_port,
44
- password: this.redis_password
47
+ url: `redis://${this.redis_host}:${this.redis_port}`,
48
+ password: this.redis_password
45
49
  });
46
- // console.log("redis is:", this.redis_sub)
50
+ this.redis_sub.on('error', err => {
51
+ reject(err);
52
+ if (callback) {
53
+ callback(err);
54
+ }
55
+ });
56
+ this.redis_sub.on('ready',function() {
57
+ resolve();
58
+ if (callback) {
59
+ callback();
60
+ }
61
+ });
47
62
  await this.redis_sub.connect();
48
63
  });
49
64
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-tybot-connector",
3
- "version": "0.2.138-rc3",
3
+ "version": "0.2.138-rc5",
4
4
  "description": "Tiledesk Tybot connector",
5
5
  "main": "index.js",
6
6
  "scripts": {