@tiledesk/tiledesk-server 2.10.53 → 2.10.55

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/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@
5
5
  🚀 IN PRODUCTION 🚀
6
6
  (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
7
7
 
8
+ # 2.10.55
9
+ - bug fix: wrong tilebot_endpoint declaration
10
+
11
+ # 2.10.54
12
+ - updated multi-worker to 0.1.19
13
+ - updated queueManagerClass to improves queue reconnect system
14
+
8
15
  # 2.10.53
9
16
  - added voice quota duration
10
17
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiledesk/tiledesk-server",
3
3
  "description": "The Tiledesk server module",
4
- "version": "2.10.53",
4
+ "version": "2.10.55",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -53,7 +53,7 @@
53
53
  "@tiledesk/tiledesk-sms-connector": "^0.1.11",
54
54
  "@tiledesk/tiledesk-vxml-connector": "^0.1.67",
55
55
  "@tiledesk/tiledesk-voice-twilio-connector": "^0.1.12",
56
- "@tiledesk/tiledesk-multi-worker": "^0.1.6",
56
+ "@tiledesk/tiledesk-multi-worker": "^0.1.19",
57
57
  "passport-oauth2": "^1.8.0",
58
58
  "amqplib": "^0.5.5",
59
59
  "app-root-path": "^3.0.0",
@@ -5,10 +5,12 @@ var configGlobal = require('../../config/global');
5
5
 
6
6
  var port = process.env.PORT || '3000';
7
7
 
8
- const TILEBOT_ENDPOINT = process.env.TILEBOT_ENDPOINT + "/ext/" || "http://localhost:" + port+ "/modules/tilebot/ext/";
9
- winston.debug("TILEBOT_ENDPOINT: " + TILEBOT_ENDPOINT);
8
+ const TILEBOT_ENDPOINT = "http://localhost:" + port + "/modules/tilebot/ext/";;
9
+ if (process.env.TILEBOT_ENDPOINT) {
10
+ TILEBOT_ENDPOINT = process.env.TILEBOT_ENDPOINT + "/ext/"
11
+ }
10
12
 
11
- winston.info("Tilebot endpoint: " + TILEBOT_ENDPOINT);
13
+ winston.debug("TILEBOT_ENDPOINT: " + TILEBOT_ENDPOINT);
12
14
 
13
15
  /**
14
16
  * process.env.API_ENDPOINT --> Internal url of the server inside the cluster
@@ -33,7 +33,10 @@ const uuidv4 = require('uuid/v4');
33
33
  var jwt = require('jsonwebtoken');
34
34
 
35
35
  const port = process.env.PORT || '3000';
36
- const TILEBOT_ENDPOINT = process.env.TILEBOT_ENDPOINT + "/ext/" || "http://localhost:" + port+ "/modules/tilebot/ext/";
36
+ const TILEBOT_ENDPOINT = "http://localhost:" + port + "/modules/tilebot/ext/";;
37
+ if (process.env.TILEBOT_ENDPOINT) {
38
+ TILEBOT_ENDPOINT = process.env.TILEBOT_ENDPOINT + "/ext/"
39
+ }
37
40
  winston.debug("TILEBOT_ENDPOINT: " + TILEBOT_ENDPOINT);
38
41
 
39
42
  class RulesTrigger {
package/routes/faq_kb.js CHANGED
@@ -250,7 +250,10 @@ router.put('/:faq_kbid/publish', roleChecker.hasRole('admin'), async (req, res)
250
250
  botEvent.emit('faqbot.update', updatedForkedChabot);
251
251
 
252
252
  const port = process.env.PORT || '3000';
253
- const TILEBOT_ENDPOINT = process.env.TILEBOT_ENDPOINT + "/ext/" || "http://localhost:" + port+ "/modules/tilebot/ext/";
253
+ const TILEBOT_ENDPOINT = "http://localhost:" + port + "/modules/tilebot/ext/";;
254
+ if (process.env.TILEBOT_ENDPOINT) {
255
+ TILEBOT_ENDPOINT = process.env.TILEBOT_ENDPOINT + "/ext/"
256
+ }
254
257
  winston.debug("TILEBOT_ENDPOINT: " + TILEBOT_ENDPOINT);
255
258
 
256
259
  let updatedOriginalChabot = await Faq_kb.findByIdAndUpdate(id_faq_kb, {url:TILEBOT_ENDPOINT+forkedChatBotId}, { new: true, upsert: true }).exec();
@@ -21,7 +21,10 @@ const projectService = require('./projectService');
21
21
  const axios = require("axios").default;
22
22
 
23
23
  let port = process.env.PORT || '3000';
24
- const TILEBOT_ENDPOINT = process.env.TILEBOT_ENDPOINT + "/ext/" || "http://localhost:" + port+ "/modules/tilebot/ext/";
24
+ const TILEBOT_ENDPOINT = "http://localhost:" + port + "/modules/tilebot/ext/";;
25
+ if (process.env.TILEBOT_ENDPOINT) {
26
+ TILEBOT_ENDPOINT = process.env.TILEBOT_ENDPOINT + "/ext/"
27
+ }
25
28
 
26
29
  let tdCache = new TdCache({
27
30
  host: process.env.CACHE_REDIS_HOST,
@@ -46,28 +46,24 @@ connect(callback) {
46
46
  amqp.connect(this.url, function(err, conn) {
47
47
  if (err) {
48
48
  // if (this.debug) {console.log("[AMQP]", err.message);
49
- // if (that.debug) {console.log("[JobWorker] AMQP", err);}
50
- console.error("[JobWorker] AMQP", err);
51
- console.log("[JobWorker] Try to reconnect");
52
-
53
- return setTimeout(function() {
54
- that.connect()
49
+ console.error("[JobWorker] AMQP error", err);
50
+ return setTimeout(function () {
51
+ if (that.debug) { console.log("[JobWorker] AMQP reconnecting"); }
52
+ that.connect(callback)
55
53
  }, 1000);
54
+
56
55
  }
57
56
  conn.on("error", function(err) {
58
- console.error("[JobWorker] err.message", err.message);
59
57
  if (err.message !== "Connection closing") {
60
- //if (that.debug) {console.log("[JobWorker] AMQP conn error", err);}
61
- console.log("[JobWorker] AMQP conn error", err)
62
- if (callback) {
63
- callback(null, err)
64
- }
58
+ console.log("[JobWorker] AMQP conn error", err);
65
59
  }
66
60
  });
67
61
  conn.on("close", function() {
68
62
  // if (that.debug) {console.log("[JobWorker] AMQP reconnecting");}
69
63
  console.log("[JobWorker] AMQP reconnecting")
70
- return setTimeout(that.connect, 1000);
64
+ return setTimeout(() => {
65
+ that.connect(callback);
66
+ }, 1000);
71
67
  });
72
68
 
73
69
  console.log("[JobWorker] AMQP connected")
@@ -101,15 +97,13 @@ whenConnected(callback) {
101
97
 
102
98
  startPublisher(callback) {
103
99
  var that = this;
104
- that.amqpConn.createConfirmChannel(function(err, ch) {
100
+ that.amqpConn.createConfirmChannel(function (err, ch) {
105
101
  if (that.closeOnErr(err)) return;
106
- ch.on("error", function(err) {
107
- // if (that.debug) {console.log("[JobWorker] - startPublisher AMQP channel error", err);}
108
- console.log("[JobWorker] - startPublisher AMQP channel error", err);
102
+ ch.on("error", function (err) {
103
+ if (that.debug) { console.log("[JobWorker] AMQP channel error", err); }
109
104
  });
110
- ch.on("close", function() {
111
- // if (that.debug) {console.log("[JobWorker] AMQP channel closed");}
112
- console.log("[JobWorker] - startPublisher AMQP channel closed")
105
+ ch.on("close", function () {
106
+ if (that.debug) { console.log("[JobWorker] AMQP channel closed"); }
113
107
  });
114
108
 
115
109
  // if (this.debug) {console.log("[AMQP] pubChannel");
@@ -122,7 +116,7 @@ startPublisher(callback) {
122
116
  // }
123
117
 
124
118
  if (callback) {
125
- callback(err);
119
+ callback(err);
126
120
  }
127
121
 
128
122
  });