wingbot-mongodb 4.2.11 → 4.2.13
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/.nyc_output/499f7b59-64e0-479d-a107-7bf801d6379b.json +1 -0
- package/.nyc_output/processinfo/499f7b59-64e0-479d-a107-7bf801d6379b.json +1 -0
- package/.nyc_output/processinfo/index.json +1 -1
- package/package.json +1 -1
- package/src/StateStorage.js +7 -6
- package/.nyc_output/6c56c7b8-6b82-4996-ac02-8b00e2cd98c7.json +0 -1
- package/.nyc_output/processinfo/6c56c7b8-6b82-4996-ac02-8b00e2cd98c7.json +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"parent":null,"pid":4156653,"argv":["/nix/store/h4apbnz8p5fmjwcmzlaxcjm5vr70d97x-nodejs-slim-24.13.0/bin/node","/home/lika85456/workspace/wingbot/wingbot-mongodb/node_modules/.bin/mocha","./test"],"execArgv":[],"cwd":"/home/lika85456/workspace/wingbot/wingbot-mongodb","time":1775126022773,"ppid":4156624,"coverageFilename":"/home/lika85456/workspace/wingbot/wingbot-mongodb/.nyc_output/499f7b59-64e0-479d-a107-7bf801d6379b.json","externalId":"","uuid":"499f7b59-64e0-479d-a107-7bf801d6379b","files":["/home/lika85456/workspace/wingbot/wingbot-mongodb/src/BaseStorage.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/defaultLogger.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/getNestedObjects.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/AttachmentCache.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/AuditLogStorage.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/BotConfigStorage.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/BotTokenStorage.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/tokenFactory.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/ChatLogStorage.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/NotificationsStorage.js","/home/lika85456/workspace/wingbot/wingbot-mongodb/src/StateStorage.js"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"processes":{"
|
|
1
|
+
{"processes":{"499f7b59-64e0-479d-a107-7bf801d6379b":{"parent":null,"children":[]}},"files":{"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/BaseStorage.js":["499f7b59-64e0-479d-a107-7bf801d6379b"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/defaultLogger.js":["499f7b59-64e0-479d-a107-7bf801d6379b"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/getNestedObjects.js":["499f7b59-64e0-479d-a107-7bf801d6379b"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/AttachmentCache.js":["499f7b59-64e0-479d-a107-7bf801d6379b"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/AuditLogStorage.js":["499f7b59-64e0-479d-a107-7bf801d6379b"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/BotConfigStorage.js":["499f7b59-64e0-479d-a107-7bf801d6379b"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/BotTokenStorage.js":["499f7b59-64e0-479d-a107-7bf801d6379b"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/tokenFactory.js":["499f7b59-64e0-479d-a107-7bf801d6379b"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/ChatLogStorage.js":["499f7b59-64e0-479d-a107-7bf801d6379b"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/NotificationsStorage.js":["499f7b59-64e0-479d-a107-7bf801d6379b"],"/home/lika85456/workspace/wingbot/wingbot-mongodb/src/StateStorage.js":["499f7b59-64e0-479d-a107-7bf801d6379b"]},"externalIds":{}}
|
package/package.json
CHANGED
package/src/StateStorage.js
CHANGED
|
@@ -13,6 +13,7 @@ const COMPOUND_INDEX = 'senderId_1_pageId_1_lastInteraction_-1';
|
|
|
13
13
|
|
|
14
14
|
const SEARCH = 'search-text';
|
|
15
15
|
const NAME = 'name_1';
|
|
16
|
+
const SENDER = 'senderId_1';
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* @typedef {object} State
|
|
@@ -59,6 +60,10 @@ class StateStorage extends BaseStorage {
|
|
|
59
60
|
this.logCollisionsAsErrors = false;
|
|
60
61
|
|
|
61
62
|
if (isCosmo) {
|
|
63
|
+
this.addIndex(
|
|
64
|
+
{ senderId: 1 },
|
|
65
|
+
{ name: SENDER }
|
|
66
|
+
);
|
|
62
67
|
this.addIndex(
|
|
63
68
|
{ name: 1 },
|
|
64
69
|
{ name: NAME }
|
|
@@ -243,12 +248,8 @@ class StateStorage extends BaseStorage {
|
|
|
243
248
|
cursor = c
|
|
244
249
|
.find(useCondition)
|
|
245
250
|
.limit(limit + 1)
|
|
246
|
-
.skip(skip)
|
|
247
|
-
|
|
248
|
-
cursor
|
|
249
|
-
.project({ score: { $meta: 'textScore' } })
|
|
250
|
-
.sort({ score: { $meta: 'textScore' } });
|
|
251
|
-
}
|
|
251
|
+
.skip(skip)
|
|
252
|
+
.sort({ lastInteraction: -1 });
|
|
252
253
|
} else {
|
|
253
254
|
cursor = c
|
|
254
255
|
.find(useCondition)
|