@tiledesk/tiledesk-server 2.3.23 โ†’ 2.3.24

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
@@ -1,6 +1,25 @@
1
1
 
2
2
 
3
+ ๐Ÿ’ฅ TILEDESK SERVER v2.3.23 ๐Ÿ’ฅ
4
+ ๐Ÿš€ TAGGED AND PUBLISHED ON NPM ๐Ÿš€
5
+ ๐Ÿš€ IN PRODUCTION ๐Ÿš€
6
+ (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.17)
7
+
8
+ # 2.3.23 -> PROD
9
+ - cacheEnabler + trigger cache + subscription cache
10
+ - project cache with cacheEnabler
11
+ - request cache with cacheEnabler
12
+ - Updated dependency @tiledesk/tiledesk-tybot-connector to 0.1.10
13
+ - Added trigger and subscription cache invalidation rules
14
+
15
+ # 2.3.22
16
+ - added cacheoose dep package.json
17
+ - Updated dependency @tiledesk/tiledesk-tybot-connector to 0.1.8
18
+
3
19
  # 2.3.21
20
+ - log fix
21
+ - Updated dependency @tiledesk/tiledesk-tybot-connector to 0.1.7
22
+ - Moved cache module to public module
4
23
  - filter request by smartAssignment
5
24
 
6
25
  # 2.3.20
@@ -11,14 +30,13 @@
11
30
  - Moved route-queue to public module
12
31
  - Disable queue module if JOB_WORKER_ENABLED is true
13
32
 
33
+ # 2.3.18.2
34
+ - logfix
14
35
 
36
+ # 2.3.18.1
37
+ - Updated dependency @tiledesk/tiledesk-tybot-connector to 0.1.10
15
38
 
16
- ๐Ÿ’ฅ TILEDESK SERVER v2.3.18 ๐Ÿ’ฅ
17
- ๐Ÿš€ TAGGED AND PUBLISHED ON NPM ๐Ÿš€
18
- ๐Ÿš€ IN PRODUCTION ๐Ÿš€
19
- (https://www.npmjs.com/package/@tiledesk/tiledesk-server/v/2.3.17)
20
-
21
- # 2.3.18 -> PROD
39
+ # 2.3.18
22
40
  - Added profileStatus field to the project_user model
23
41
  - Added smartAssignment field to the request model
24
42
  - Canned responses default limit value increased from 40 to 1000
package/app.js CHANGED
@@ -142,8 +142,7 @@ botSubscriptionNotifier.start();
142
142
 
143
143
 
144
144
  var geoService = require('./services/geoService');
145
- geoService.listen();
146
-
145
+ geoService.listen();
147
146
 
148
147
 
149
148
 
@@ -323,7 +322,7 @@ var projectSetter = function (req, res, next) {
323
322
  if (projectid) {
324
323
 
325
324
  let q = Project.findOne({_id: projectid, status: 100});
326
- if (cacheEnabler.trigger) {
325
+ if (cacheEnabler.project) {
327
326
  q.cache(cacheUtil.defaultTTL, "projects:id:"+projectid) //project_cache
328
327
  winston.debug('project cache enabled');
329
328
  }
@@ -9,6 +9,8 @@ var Project_user = require("../../models/project_user");
9
9
  var RequestConstants = require("../../models/requestConstants");
10
10
 
11
11
  var cacheUtil = require('../../utils/cacheUtil');
12
+ var cacheEnabler = require("../../services/cacheEnabler");
13
+
12
14
 
13
15
  var mongoose = require('mongoose');
14
16
  var winston = require('../../config/winston');
@@ -73,11 +75,17 @@ router.post('/', function (req, res) {
73
75
  winston.debug("Chat21 message", message);
74
76
 
75
77
  // requestcachefarequi nocachepopulatereqired
76
- return Request.findOne({request_id: message.recipient})
78
+ let q = Request.findOne({request_id: message.recipient})
79
+
80
+ if (cacheEnabler.request) {
81
+ q.cache(cacheUtil.defaultTTL, "requests:request_id:"+message.recipient+":simple"); //request_cache
82
+ // project_id not available
83
+ winston.debug('request cache enabled');
84
+ }
85
+ return q.exec(function(err, request) {
86
+
77
87
  // before request_id id_project unique - commented
78
- // return Request.findOne({request_id: message.recipient, id_project: projectid})
79
- // .cache(cacheUtil.defaultTTL, req.projectid+":requests:request_id:"+requestid) project_id not available
80
- .exec(function(err, request) {
88
+
81
89
 
82
90
  if (err) {
83
91
  return res.status(500).send({success: false, msg: 'Error getting the request.', err:err});
@@ -202,7 +210,7 @@ router.post('/', function (req, res) {
202
210
  }
203
211
 
204
212
 
205
-
213
+
206
214
 
207
215
 
208
216
  var new_request = {
@@ -210,7 +218,7 @@ router.post('/', function (req, res) {
210
218
  departmentid:departmentid, sourcePage:sourcePage, language:language, userAgent:client, status:requestStatus, createdBy: undefined,
211
219
  attributes:rAttributes, subject:undefined, preflight:false, channel:undefined, location:undefined,
212
220
  lead:createdLead, requester:project_user
213
-
221
+
214
222
  };
215
223
 
216
224
  winston.debug("new_request", new_request);
@@ -379,10 +387,10 @@ router.post('/', function (req, res) {
379
387
  winston.debug('query:'+ projectId);
380
388
 
381
389
  let q = Request.findOne(query);
382
- if (cacheEnabler.trigger) {
383
- q.cache(cacheUtil.defaultTTL, projectId+":requests:request_id:"+recipient_id); //request_cache
384
- winston.debug('project cache enabled');
385
- }
390
+ // if (cacheEnabler.request) {
391
+ // q.cache(cacheUtil.defaultTTL, projectId+":requests:request_id:"+recipient_id+":simple"); //request_cache NOT IMPORTANT HERE
392
+ // winston.debug('project cache enabled');
393
+ // }
386
394
  return q.exec(function(err, request) {
387
395
 
388
396
  if (err) {
@@ -465,7 +473,7 @@ router.post('/', function (req, res) {
465
473
 
466
474
  // requestcachefarequi populaterequired
467
475
  return Request.findOne({request_id: request_id, id_project: id_project})
468
- .populate('lead') //TODO posso prenderlo da snapshot senza populate
476
+ .populate('lead') //TODO posso prenderlo da snapshot senza populate cache_attention
469
477
  .exec(function(err, request) {
470
478
  if (err){
471
479
  winston.error(err);
@@ -632,7 +640,7 @@ else if (req.body.event_type == "typing-start") {
632
640
  // requestcachefarequi nocachepopulatereqired
633
641
  return Request.findOne({request_id: recipient_id})
634
642
  //TOD errore cache sistemare e riabbilitare->
635
- // .cache(cacheUtil.defaultTTL, req.projectid+":requests:request_id:"+recipient_id)
643
+ // .cache(cacheUtil.defaultTTL, req.projectid+":requests:request_id:"+recipient_id) cache_attention
636
644
  .exec(function(err, request) {
637
645
  if (err){
638
646
  winston.error(err);
@@ -34,14 +34,18 @@ function emitCompleteMessage(message) {
34
34
  }
35
35
 
36
36
  messageEvent.on('message.create', emitCompleteMessage);
37
- messageEvent.on('message.update', emitCompleteMessage);
37
+
38
+ // messageEvent.on('message.update.simple', emitCompleteMessage); //if populateMessageUpdate is disabled then you must forward message.update event from message.update.simple
39
+ messageEvent.on('message.update', emitCompleteMessage); // i must restore populateMessageWithRequest. see below
38
40
 
39
41
  function populateMessageCreate(message) {
40
42
  return populateMessageWithRequest(message, 'message.create');
41
43
  }
42
44
  function populateMessageUpdate(message) {
43
- // return populateMessageWithRequest(message, 'message.update');
44
- return; // do not populate message.update it's not used by anyone. Not used by webhook. populate for message.update is slow.
45
+ return populateMessageWithRequest(message, 'message.update');
46
+ // return; // do not populate message.update it's not used by anyone.
47
+ ///it is used by \agent interceptor. Without populateMessageWithRequest \agent sent by bot doesn't work. i must restore populateMessageWithRequest
48
+ // Not used by webhook. populate for message.update is slow.
45
49
  }
46
50
 
47
51
 
@@ -70,8 +74,7 @@ function populateMessageWithRequest(message, eventPrefix) {
70
74
  // request.department._id DA CORREGGERE ANCHE PER REQUEST.CREATE
71
75
  // request.department.hasBot
72
76
  // request.isOpen
73
-
74
-
77
+ winston.info('message Event populate');
75
78
  if (cacheEnabler.request) {
76
79
  q.cache(cacheUtil.defaultTTL, message.id_project+":requests:request_id:"+message.recipient) //request_cache ma con lean????attento metti a parte
77
80
  winston.debug('request cache enabled');
@@ -83,6 +86,9 @@ function populateMessageWithRequest(message, eventPrefix) {
83
86
  return messageEvent.emit(eventPrefix, message);
84
87
  }
85
88
 
89
+ winston.debug('message Event populate after query');
90
+
91
+
86
92
  if (request) {
87
93
  winston.debug("request is defined in messageEvent",request );
88
94
 
@@ -91,9 +97,14 @@ function populateMessageWithRequest(message, eventPrefix) {
91
97
 
92
98
  if (request.department && request.department.id_bot) {
93
99
  // if (request.department) {
94
- Faq_kb.findById(request.department.id_bot)
95
- //@DISABLED_CACHE .cache(cacheUtil.defaultTTL, message.id_project+":faq_kbs:id:"+request.department.id_bot)
96
- .exec(function(err, bot) {
100
+ let qbot = Faq_kb.findById(request.department.id_bot)
101
+
102
+ if (cacheEnabler.faq_kb) {
103
+ qbot.cache(cacheUtil.defaultTTL, message.id_project+":faq_kbs:id:"+request.department.id_bot)
104
+ winston.debug('faq_kb cache enabled');
105
+ }
106
+
107
+ qbot.exec(function(err, bot) {
97
108
  winston.debug('bot', bot);
98
109
  requestJson.department.bot = bot
99
110
 
@@ -169,10 +180,12 @@ messageEvent.on('message.update.simple', populateMessageUpdate);
169
180
 
170
181
 
171
182
 
172
- // riattiva commentato per performance
183
+ // // riattiva commentato per performance
184
+
173
185
  // // spostare su classe
174
186
 
175
187
 
188
+
176
189
  // var messageCreateKey = 'message.create';
177
190
  // if (messageEvent.queueEnabled) {
178
191
  // messageCreateKey = 'message.create.queue';
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.3.23",
4
+ "version": "2.3.24",
5
5
  "scripts": {
6
6
  "start": "node ./bin/www",
7
7
  "pretest": "mongodb-runner start",
@@ -41,7 +41,7 @@
41
41
  "@tiledesk/tiledesk-chatbot-util": "^0.8.33",
42
42
  "@tiledesk/tiledesk-json-rules-engine": "^4.0.3",
43
43
  "@tiledesk/tiledesk-rasa-connector": "^1.0.10",
44
- "@tiledesk/tiledesk-tybot-connector": "^0.1.10",
44
+ "@tiledesk/tiledesk-tybot-connector": "^0.1.14",
45
45
  "app-root-path": "^3.0.0",
46
46
  "bcrypt-nodejs": "0.0.3",
47
47
  "body-parser": "^1.20.0",
@@ -203,6 +203,35 @@
203
203
 
204
204
 
205
205
 
206
+ requestEvent.on("request.create.simple", function(request) {
207
+ setImmediate(() => {
208
+ var key = request.id_project+":requests:id:"+request.id+":simple";
209
+ winston.verbose("Creating cache for request.create.simple with key: " + key);
210
+
211
+ client.set(key, request, defaultTTL, (err, reply) => {
212
+ winston.debug("Created cache for request.create.simple",reply);
213
+ winston.verbose("Created cache for request.create.simple",{err:err});
214
+ });
215
+
216
+
217
+ var key = "requests:id:"+request.request_id+":simple"; //without project for chat21 webhook
218
+ winston.verbose("Creating cache for request.create.simple with key: " + key);
219
+
220
+ client.set(key, request, defaultTTL, (err, reply) => {
221
+ winston.debug("Created cache for request.create.simple",reply);
222
+ winston.verbose("Created cache for request.create.simple",{err:err});
223
+ });
224
+
225
+ var key = request.id_project+":requests:request_id:"+request.request_id+":simple";
226
+ winston.verbose("Creating cache for request.create.simple with key: " + key);
227
+ client.set(key, request, defaultTTL, (err, reply) => {
228
+ winston.debug("Created cache for request.create.simple",reply);
229
+ winston.verbose("Created cache for request.create.simple",{err:err});
230
+ });
231
+
232
+ })
233
+ });
234
+
206
235
  requestEvent.on("request.create", function(request) {
207
236
  setImmediate(() => {
208
237
  var key = request.id_project+":requests:id:"+request.id;
@@ -45,7 +45,7 @@ class MessageTransformerInterceptor {
45
45
  // populate({path:'requester',populate:{path:'id_user'}}).
46
46
 
47
47
  if (cacheEnabler.request) {
48
- q.cache(cacheUtil.defaultTTL, message.id_project+":requests:request_id:"+message.recipient) //request_cache nocachepopulatereqired
48
+ q.cache(cacheUtil.defaultTTL, message.id_project+":requests:request_id:"+message.recipient+":simple") //request_cache nocachepopulatereqired
49
49
  winston.debug('request cache enabled');
50
50
  }
51
51
 
package/routes/message.js CHANGED
@@ -53,7 +53,7 @@ async (req, res) => {
53
53
  return res.status(422).json({ errors: errors.array() });
54
54
  }
55
55
 
56
-
56
+
57
57
  var project_user = req.projectuser;
58
58
  var sender = req.body.sender;
59
59
  var fullname = req.body.senderFullname || req.user.fullName;
@@ -64,7 +64,7 @@ async (req, res) => {
64
64
 
65
65
  let q = Request.findOne({request_id: req.params.request_id, id_project: req.projectid});
66
66
  if (cacheEnabler.request) {
67
- q.cache(cacheUtil.defaultTTL, req.projectid+":requests:request_id:"+req.params.request_id) //request_cache
67
+ q.cache(cacheUtil.defaultTTL, req.projectid+":requests:request_id:"+req.params.request_id+":simple") //request_cache
68
68
  winston.debug('request cache enabled');
69
69
  }
70
70
  // cacherequest // requestcachefarequi nocachepopulatereqired
@@ -295,6 +295,9 @@ async (req, res) => {
295
295
  });
296
296
 
297
297
 
298
+
299
+
300
+
298
301
  // router.put('/:messageid', function(req, res) {
299
302
 
300
303
  // console.log(req.body);
package/routes/project.js CHANGED
@@ -451,7 +451,7 @@ Project.findByIdAndUpdate(req.params.projectid, { $pull: { bannedUsers: { "_id":
451
451
  router.get('/:projectid', [passport.authenticate(['basic', 'jwt'], { session: false }), validtoken, roleChecker.hasRoleOrTypes('agent', ['subscription'])], function (req, res) {
452
452
  winston.debug(req.body);
453
453
  let q = Project.findOne({_id: req.params.projectid, status:100});
454
- if (cacheEnabler.trigger) {
454
+ if (cacheEnabler.project) {
455
455
  q.cache(cacheUtil.defaultTTL, "projects:id:"+req.params.projectid) //project_cache
456
456
  winston.debug('project cache enabled');
457
457
  }
package/routes/request.js CHANGED
@@ -1266,10 +1266,10 @@ router.get('/:requestid', function (req, res) {
1266
1266
  .populate('participatingAgents')
1267
1267
  .populate({path:'requester',populate:{path:'id_user'}});
1268
1268
 
1269
- if (cacheEnabler.request) {
1270
- q.cache(cacheUtil.defaultTTL, "/"+req.projectid+"/requests/request_id/"+requestid) //request_cache
1271
- winston.debug('request cache enabled');
1272
- }
1269
+ // if (cacheEnabler.request) { cache disabled beacuse cacheoose don't support .populate without lean. here cache is not important
1270
+ // q.cache(cacheUtil.defaultTTL, req.projectid+":requests:request_id:"+requestid) //request_cache
1271
+ // winston.debug('request cache enabled');
1272
+ // }
1273
1273
  //
1274
1274
  // .populate({path:'requester',populate:{path:'id_user', select:{'firstname':1, 'lastname':1}}})
1275
1275
  q.exec(function(err, request) {
@@ -21,20 +21,26 @@ class CacheEnabler {
21
21
  this.request = false;
22
22
  }
23
23
 
24
- this.project_user = true;
25
- if (process.env.CACHE_PROJECT_USER_ENABLED=="false" || process.env.CACHE_PROJECT_USER_ENABLED==false) {
26
- this.project_user = false;
24
+ this.faq_kb = true;
25
+ if (process.env.CACHE_FAQ_KB_ENABLED=="false" || process.env.CACHE_FAQ_KB_ENABLED==false) {
26
+ this.faq_kb = false;
27
27
  }
28
28
 
29
- this.user = true;
30
- if (process.env.CACHE_USER_ENABLED=="false" || process.env.CACHE_USER_ENABLED==false) {
31
- this.user = false;
32
- }
33
-
34
- this.message = true;
35
- if (process.env.CACHE_MESSAGE_ENABLED=="false" || process.env.CACHE_MESSAGE_ENABLED==false) {
36
- this.message = false;
37
- }
29
+
30
+ // this.project_user = true;
31
+ // if (process.env.CACHE_PROJECT_USER_ENABLED=="false" || process.env.CACHE_PROJECT_USER_ENABLED==false) {
32
+ // this.project_user = false;
33
+ // }
34
+
35
+ // this.user = true;
36
+ // if (process.env.CACHE_USER_ENABLED=="false" || process.env.CACHE_USER_ENABLED==false) {
37
+ // this.user = false;
38
+ // }
39
+
40
+ // this.message = true;
41
+ // if (process.env.CACHE_MESSAGE_ENABLED=="false" || process.env.CACHE_MESSAGE_ENABLED==false) {
42
+ // this.message = false;
43
+ // }
38
44
  }
39
45
  }
40
46
 
@@ -8,6 +8,8 @@ var winston = require('../config/winston');
8
8
  const departmentEvent = require('../event/departmentEvent');
9
9
  const Request = require('../models/request');
10
10
  const RoleConstants = require ('../models/roleConstants')
11
+ var cacheEnabler = require("../services/cacheEnabler");
12
+ var cacheUtil = require("../utils/cacheUtil");
11
13
 
12
14
  class DepartmentService {
13
15
 
@@ -86,7 +88,7 @@ roundRobin(operatorSelectedEvent) {
86
88
 
87
89
  // let lastRequests = await
88
90
  // requestcachefarequi nocachepopulatereqired
89
- Request.find(query).sort({_id:-1}).limit(1).exec(function (err, lastRequests) {
91
+ Request.find(query).sort({_id:-1}).limit(1).exec(function (err, lastRequests) { // cache_attention
90
92
  if (err) {
91
93
  winston.error('Error getting request for RoundRobinOperator', err);
92
94
  return reject(err);
@@ -190,7 +192,12 @@ getOperators(departmentid, projectid, nobot, disableWebHookCall, context) {
190
192
  // console.log("ยปยปยป ยปยปยป --> DEPT ID ", departmentid);
191
193
 
192
194
 
193
- return Project.findOne({_id: projectid, status: 100}, function(err, project) {
195
+ let q = Project.findOne({_id: projectid, status: 100})
196
+ if (cacheEnabler.project) {
197
+ q.cache(cacheUtil.defaultTTL, "projects:id:"+projectid) //project_cache
198
+ winston.debug('project cache enabled');
199
+ }
200
+ return q.exec(function(err, project){
194
201
  if (err) {
195
202
  winston.error('Project findById ', err);
196
203
  return reject(err);
@@ -205,6 +212,7 @@ getOperators(departmentid, projectid, nobot, disableWebHookCall, context) {
205
212
  // TODO questo lo abiliterei solo esplicitamete se si flagga opzione su progetto per performance
206
213
  if (disableWebHookCall==undefined) {
207
214
  //if pro enabled disableWebHookCall = false
215
+ //secondo me qui manca un parentesi tonda per gli or
208
216
  if (project.profile && (project.profile.type === 'free' && project.trialExpired === false) || (project.profile.type === 'payment' && project.isActiveSubscription === true)) {
209
217
  // winston.info('disableWebHookCall pro');
210
218
  disableWebHookCall = false;
@@ -389,6 +397,7 @@ getOperators(departmentid, projectid, nobot, disableWebHookCall, context) {
389
397
 
390
398
  let objectToReturn = { available_agents: _available_agents, agents: project_users, operators: selectedoperator, department: department, group: group, id_project: projectid, project: project, context: context };
391
399
 
400
+ // var objectToReturnRoundRobin = objectToReturn;
392
401
  that.roundRobin(objectToReturn).then(function(objectToReturnRoundRobin){
393
402
 
394
403
  winston.debug("context2",context);
@@ -450,6 +459,8 @@ getOperators(departmentid, projectid, nobot, disableWebHookCall, context) {
450
459
 
451
460
  let objectToReturn = { available_agents: _available_agents, agents: project_users, operators: selectedoperator, department: department, id_project: projectid, project: project, context: context };
452
461
 
462
+ // var objectToReturnRoundRobin = objectToReturn;
463
+
453
464
  that.roundRobin(objectToReturn).then(function(objectToReturnRoundRobin) {
454
465
  winston.debug("context2",context);
455
466
  departmentEvent.emit('operator.select.base1', {result:objectToReturnRoundRobin, disableWebHookCall: disableWebHookCall, resolve: resolve, reject: reject, context: context});
@@ -543,8 +554,19 @@ getOperators(departmentid, projectid, nobot, disableWebHookCall, context) {
543
554
 
544
555
  // console.log('-- > OPERATORS [ getRandomAvailableOperator ] - PROJECT USER AVAILABLE LENGHT ', project_users_available.length);
545
556
  if (project_users_available.length > 0) {
557
+
558
+
559
+ // new
560
+ // num between 0 and 1 * es 3 ->
561
+ // let randomIndex = Math.round(Math.random() * project_users_available.length);
562
+ // // let randomIndex = Math.floor(Math.random() * project_users_available.length);
563
+
564
+ // console.log("randomIndex",randomIndex);
565
+ // var operator = project_users_available[randomIndex];
566
+ // // console.log('OPERATORS - SELECTED MEMBER ID', operator.id_user);
567
+
546
568
  var operator = project_users_available[Math.floor(Math.random() * project_users_available.length)];
547
- // console.log('OPERATORS - SELECTED MEMBER ID', operator.id_user);
569
+
548
570
 
549
571
  return [{ id_user: operator.id_user }];
550
572
  // return [operator];
@@ -12,7 +12,7 @@ class OperatingHoursService {
12
12
 
13
13
  // winston.debug('O ---> [ OHS ] -> PROJECT ID ', projectId)
14
14
  let q = Project.findOne({_id: projectId, status: 100});
15
- if (cacheEnabler.trigger) {
15
+ if (cacheEnabler.project) {
16
16
  q.cache(cacheUtil.defaultTTL, "projects:id:"+projectId) //project_cache
17
17
  winston.debug('project cache enabled');
18
18
  }
@@ -40,6 +40,7 @@ class OperatingHoursService {
40
40
  // IF THE TRIAL IS EXPIRED OR IF THE SUBSCIPTION IS NOT ACTIVE THE PROJECT IS ALWAYS OPEN EVEN IF activeOperatingHours IS SETTED TO true AND, FOR EXAMPLE,
41
41
  // THE USER HAS SETTED ALL DAYS TO CLOSED
42
42
 
43
+ //secondo me qui manca un parentesi tonda per gli or
43
44
  if (project.profile && (project.profile.type === 'free' && project.trialExpired === true) || (project.profile.type === 'payment' && project.isActiveSubscription === false)) {
44
45
  winston.debug('O ---> [ OHS ] -> trial Expired OR Subscription NOT Active - PROJECT ALWAYS OPEN')
45
46
  callback(true, null) ;
@@ -231,7 +231,7 @@ class RequestService {
231
231
  .findOne({request_id: request_id, id_project: id_project});
232
232
 
233
233
  if (cacheEnabler.request) {
234
- q.cache(cacheUtil.defaultTTL, id_project+":requests:request_id:"+request_id) //request_cache
234
+ q.cache(cacheUtil.defaultTTL, id_project+":requests:request_id:"+request_id+":simple") //request_cache
235
235
  winston.debug('request cache enabled');
236
236
  }
237
237
  return q.exec( function(err, request) {
@@ -387,7 +387,7 @@ class RequestService {
387
387
  .findOne({request_id: request_id, id_project: id_project});
388
388
 
389
389
  if (cacheEnabler.request) {
390
- q.cache(cacheUtil.defaultTTL, id_project+":requests:request_id:"+request_id) //request_cache
390
+ q.cache(cacheUtil.defaultTTL, id_project+":requests:request_id:"+request_id+":simple") //request_cache
391
391
  winston.debug('request cache enabled');
392
392
  }
393
393
 
@@ -981,10 +981,10 @@ class RequestService {
981
981
  .populate('participatingAgents')
982
982
  .populate({path:'requester',populate:{path:'id_user'}});
983
983
 
984
- if (cacheEnabler.request) {
985
- q.cache(cacheUtil.defaultTTL, id_project+":requests:request_id:"+request_id) //request_cache
986
- winston.debug('request cache enabled');
987
- }
984
+ // if (cacheEnabler.request) { //attention this cache is not usable bacause cacheoose don't support populate without .lean.. so if cached populated field is not returned with cacheoose, updateWaitingTime is only used in chat21webhook but i thik it is important for messages route
985
+ // q.cache(cacheUtil.defaultTTL, id_project+":requests:request_id:"+request_id) //request_cache
986
+ // winston.debug('request cache enabled');
987
+ // }
988
988
  q.exec(function(err, request) {
989
989
  if (err) {
990
990
  winston.error(err);
@@ -93,7 +93,7 @@ class WebSocketServer {
93
93
  // winston.debug('ok websocket');
94
94
 
95
95
  User.findOne({_id: identifier, status: 100}, 'email firstname lastname emailverified id')
96
- //@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+identifier)
96
+ //@DISABLED_CACHE .cache(cacheUtil.defaultTTL, "users:id:"+identifier) //user_cache
97
97
  .exec(function (err, user) {
98
98
 
99
99
 
@@ -187,7 +187,7 @@ class WebSocketServer {
187
187
 
188
188
  let q = Project.findOne({ _id: projectId, status: 100})
189
189
 
190
- if (cacheEnabler.trigger) {
190
+ if (cacheEnabler.project) {
191
191
  q.cache(cacheUtil.defaultTTL, "projects:id:"+projectId) //project_cache
192
192
  winston.debug('project cache enabled');
193
193
  }