@tiledesk/tiledesk-server 2.9.14 → 2.9.16
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,12 @@
|
|
|
5
5
|
🚀 IN PRODUCTION 🚀
|
|
6
6
|
(https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.77)
|
|
7
7
|
|
|
8
|
+
# 2.9.16
|
|
9
|
+
- Update: change automatically the content status on re-index
|
|
10
|
+
|
|
11
|
+
# 2.9.15
|
|
12
|
+
- Updated jobs-worker-queue-manager
|
|
13
|
+
|
|
8
14
|
# 2.9.14
|
|
9
15
|
- Added replace option in chatbot import json
|
|
10
16
|
- Added field project_user, fullname, email and assigned requests to what /users/availables returns
|
package/package.json
CHANGED
package/routes/kb.js
CHANGED
|
@@ -28,8 +28,12 @@ let jobManager = new JobManager(AMQP_MANAGER_URL, {
|
|
|
28
28
|
exchange: JOB_TOPIC_EXCHANGE
|
|
29
29
|
})
|
|
30
30
|
|
|
31
|
-
jobManager.connectAndStartPublisher(() => {
|
|
32
|
-
|
|
31
|
+
jobManager.connectAndStartPublisher((status, error) => {
|
|
32
|
+
if (error) {
|
|
33
|
+
winston.error("connectAndStartPublisher error: ", error);
|
|
34
|
+
} else {
|
|
35
|
+
winston.info("KbRoute - ConnectPublisher done with status: ", status);
|
|
36
|
+
}
|
|
33
37
|
})
|
|
34
38
|
|
|
35
39
|
let default_preview_settings = {
|
|
@@ -1204,14 +1208,20 @@ async function startScrape(data) {
|
|
|
1204
1208
|
data.gptkey = gptkey;
|
|
1205
1209
|
}
|
|
1206
1210
|
|
|
1211
|
+
|
|
1212
|
+
let status_updated = await updateStatus(data.id, 200);
|
|
1213
|
+
winston.verbose("status of kb " + data.id + " updated: " + status_updated);
|
|
1214
|
+
|
|
1207
1215
|
return new Promise((resolve, reject) => {
|
|
1208
1216
|
openaiService.singleScrape(data).then(async (resp) => {
|
|
1209
1217
|
winston.debug("singleScrape resp: ", resp.data);
|
|
1210
|
-
let status_updated = await updateStatus(data.id,
|
|
1218
|
+
let status_updated = await updateStatus(data.id, 300);
|
|
1211
1219
|
winston.verbose("status of kb " + data.id + " updated: " + status_updated);
|
|
1212
1220
|
resolve(resp.data);
|
|
1213
|
-
}).catch((err) => {
|
|
1221
|
+
}).catch( async (err) => {
|
|
1214
1222
|
winston.error("singleScrape err: ", err);
|
|
1223
|
+
let status_updated = await updateStatus(data.id, 400);
|
|
1224
|
+
winston.verbose("status of kb " + data.id + " updated: " + status_updated);
|
|
1215
1225
|
reject(err);
|
|
1216
1226
|
})
|
|
1217
1227
|
})
|
|
@@ -21,7 +21,15 @@ class JobManager {
|
|
|
21
21
|
var that = this;
|
|
22
22
|
if (this.info) {console.log("[JobWorker] JobManager publisher started");}
|
|
23
23
|
|
|
24
|
-
this.queueManager.connect(function() {
|
|
24
|
+
this.queueManager.connect(function(status, err) {
|
|
25
|
+
|
|
26
|
+
if (err) {
|
|
27
|
+
console.log("[JobWorker] - connectAndStartPublisher - connection error: ", err);
|
|
28
|
+
if (callback) {
|
|
29
|
+
callback(null, err)
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
25
33
|
if (that.debug) {console.log("[JobWorker] Queue started");}
|
|
26
34
|
that.queuePublisherConnected = true;
|
|
27
35
|
|
|
@@ -41,7 +49,8 @@ class JobManager {
|
|
|
41
49
|
}
|
|
42
50
|
|
|
43
51
|
if (callback) {
|
|
44
|
-
callback();
|
|
52
|
+
callback(status, null);
|
|
53
|
+
return;
|
|
45
54
|
}
|
|
46
55
|
});
|
|
47
56
|
});
|
|
@@ -46,29 +46,37 @@ 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);}
|
|
49
|
+
// if (that.debug) {console.log("[JobWorker] AMQP", err);}
|
|
50
|
+
console.error("[JobWorker] AMQP", err);
|
|
51
|
+
console.log("[JobWorker] Try to reconnect");
|
|
50
52
|
|
|
51
53
|
return setTimeout(function() {
|
|
52
54
|
that.connect()
|
|
53
55
|
}, 1000);
|
|
54
56
|
}
|
|
55
57
|
conn.on("error", function(err) {
|
|
58
|
+
console.error("[JobWorker] err.message", err.message);
|
|
56
59
|
if (err.message !== "Connection closing") {
|
|
57
|
-
if (that.debug) {console.log("[JobWorker] AMQP conn error", err);}
|
|
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
65
|
}
|
|
59
66
|
});
|
|
60
67
|
conn.on("close", function() {
|
|
61
|
-
if (that.debug) {console.log("[JobWorker] AMQP reconnecting");}
|
|
68
|
+
// if (that.debug) {console.log("[JobWorker] AMQP reconnecting");}
|
|
69
|
+
console.log("[JobWorker] AMQP reconnecting")
|
|
62
70
|
return setTimeout(that.connect, 1000);
|
|
63
71
|
});
|
|
64
72
|
|
|
65
|
-
|
|
73
|
+
console.log("[JobWorker] AMQP connected")
|
|
66
74
|
that.amqpConn = conn;
|
|
67
75
|
|
|
68
76
|
// that.whenConnected(callback);
|
|
69
77
|
|
|
70
78
|
if (callback) {
|
|
71
|
-
callback();
|
|
79
|
+
callback('Connected', null);
|
|
72
80
|
}
|
|
73
81
|
// return resolve();
|
|
74
82
|
// });
|
|
@@ -96,10 +104,12 @@ startPublisher(callback) {
|
|
|
96
104
|
that.amqpConn.createConfirmChannel(function(err, ch) {
|
|
97
105
|
if (that.closeOnErr(err)) return;
|
|
98
106
|
ch.on("error", function(err) {
|
|
99
|
-
if (that.debug) {console.log("[JobWorker] AMQP channel error", err);}
|
|
107
|
+
// if (that.debug) {console.log("[JobWorker] - startPublisher AMQP channel error", err);}
|
|
108
|
+
console.log("[JobWorker] - startPublisher AMQP channel error", err);
|
|
100
109
|
});
|
|
101
110
|
ch.on("close", function() {
|
|
102
|
-
if (that.debug) {console.log("[JobWorker] AMQP channel closed");}
|
|
111
|
+
// if (that.debug) {console.log("[JobWorker] AMQP channel closed");}
|
|
112
|
+
console.log("[JobWorker] - startPublisher AMQP channel closed")
|
|
103
113
|
});
|
|
104
114
|
|
|
105
115
|
// if (this.debug) {console.log("[AMQP] pubChannel");
|