@tiledesk/tiledesk-tybot-connector 0.1.64 → 0.1.65
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 +3 -0
- package/models/MongodbBotsDataSource.js +12 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -121,28 +121,28 @@ class MongodbBotsDataSource {
|
|
|
121
121
|
|
|
122
122
|
async getByIntentDisplayNameCache(botId, key, tdcache) {
|
|
123
123
|
let faq = null;
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
console.log("botID:", botId);
|
|
125
|
+
console.log("key:", key);
|
|
126
126
|
if (tdcache) {
|
|
127
|
-
|
|
127
|
+
console.log("in tdcache");
|
|
128
128
|
let faqCacheKey = "cacheman:cachegoose-cache:faqs:botid:"+ botId + ":faq:id:" + key;
|
|
129
|
-
|
|
129
|
+
console.log("Looking in cache for:", faqCacheKey);
|
|
130
130
|
try {
|
|
131
131
|
let _faq_as_string = await tdcache.get(faqCacheKey);
|
|
132
132
|
const value_type = typeof _faq_as_string;
|
|
133
|
-
|
|
134
|
-
|
|
133
|
+
console.log("_faq_as_string found in chache:", _faq_as_string);
|
|
134
|
+
console.log("value_type:", value_type);
|
|
135
135
|
if (_faq_as_string) {
|
|
136
136
|
faq = JSON.parse(_faq_as_string);
|
|
137
|
-
|
|
137
|
+
console.log("got faq from cache:", JSON.stringify(faq));
|
|
138
138
|
}
|
|
139
139
|
else {
|
|
140
|
-
|
|
140
|
+
console.log("faq not found, getting from datasource...");
|
|
141
141
|
faq = await this.getByIntentDisplayName(botId, key);
|
|
142
|
-
|
|
142
|
+
console.log(".faq found in datasource:", JSON.stringify(faq));
|
|
143
143
|
await tdcache.set(faqCacheKey, JSON.stringify(faq));
|
|
144
144
|
// DEBUG CODE REMOVE
|
|
145
|
-
let faq_ = await tdcache.get(faqCacheKey);
|
|
145
|
+
// let faq_ = await tdcache.get(faqCacheKey);
|
|
146
146
|
// console.log("_faq_as_string from cache debug:", faq_)
|
|
147
147
|
}
|
|
148
148
|
}
|
|
@@ -151,9 +151,9 @@ class MongodbBotsDataSource {
|
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
else {
|
|
154
|
-
|
|
154
|
+
console.log("no chache. getting faq from datasource...");
|
|
155
155
|
faq = await this.getByIntentDisplayName(botId, key);
|
|
156
|
-
|
|
156
|
+
console.log("faq found in datasource (no-cache):", JSON.stringify(faq));
|
|
157
157
|
}
|
|
158
158
|
return faq;
|
|
159
159
|
}
|