wingbot 3.30.0 → 3.30.1
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/package.json
CHANGED
|
@@ -452,7 +452,7 @@ class NotificationsStorage {
|
|
|
452
452
|
* @param {string} tag
|
|
453
453
|
* @returns {Promise}
|
|
454
454
|
*/
|
|
455
|
-
|
|
455
|
+
_subscribe (senderId, pageId, tag) {
|
|
456
456
|
const key = `${senderId}|${pageId}`;
|
|
457
457
|
let subscribtion = this._subscribtions.get(key);
|
|
458
458
|
if (!subscribtion) {
|
|
@@ -467,6 +467,18 @@ class NotificationsStorage {
|
|
|
467
467
|
}
|
|
468
468
|
|
|
469
469
|
this._subscribtions.set(key, subscribtion);
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
*
|
|
474
|
+
* @param {string|string[]} senderId
|
|
475
|
+
* @param {string} pageId
|
|
476
|
+
* @param {string} tag
|
|
477
|
+
* @returns {Promise}
|
|
478
|
+
*/
|
|
479
|
+
subscribe (senderId, pageId, tag) {
|
|
480
|
+
const insert = Array.isArray(senderId) ? senderId : [senderId];
|
|
481
|
+
insert.forEach((sender) => this._subscribe(sender, pageId, tag));
|
|
470
482
|
return Promise.resolve();
|
|
471
483
|
}
|
|
472
484
|
|
|
@@ -198,12 +198,16 @@ function notificationsApiFactory (storage, notifications, acl, options = {}) {
|
|
|
198
198
|
);
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
senderIds = senderIds.slice();
|
|
202
|
+
|
|
201
203
|
// make it little bit faster
|
|
202
204
|
while (senderIds.length > 0) {
|
|
203
|
-
|
|
204
|
-
senderIds.splice(0,
|
|
205
|
-
|
|
206
|
-
|
|
205
|
+
if (storage.subscribe.length > 3) {
|
|
206
|
+
const insertSenders = senderIds.splice(0, 500);
|
|
207
|
+
await storage.subscribe(insertSenders, pageId, tag, true);
|
|
208
|
+
} else {
|
|
209
|
+
await storage.subscribe(senderIds.pop(), pageId, tag);
|
|
210
|
+
}
|
|
207
211
|
}
|
|
208
212
|
|
|
209
213
|
return true;
|