@shushed/helpers 0.0.183 → 0.0.184
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/dist/index.js +6 -4
- package/dist/package.json +1 -0
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -107123,6 +107123,7 @@ var env_default = EnvEngine;
|
|
|
107123
107123
|
var import_co_body = __toESM(require("co-body"));
|
|
107124
107124
|
var import_lodash = __toESM(require("lodash.isequal"));
|
|
107125
107125
|
var import_lodash2 = __toESM(require("lodash.omit"));
|
|
107126
|
+
var import_p_limit = __toESM(require("p-limit"));
|
|
107126
107127
|
function isPubSubMessage(req) {
|
|
107127
107128
|
return req && typeof req.ack === "function" && typeof req.data !== "undefined" && typeof req.ackId !== "undefined";
|
|
107128
107129
|
}
|
|
@@ -107183,11 +107184,12 @@ var PubSubHelper = class extends Runtime {
|
|
|
107183
107184
|
return message;
|
|
107184
107185
|
}
|
|
107185
107186
|
async publish(options, payload, orgMessage) {
|
|
107187
|
+
const limit = (0, import_p_limit.default)(10);
|
|
107186
107188
|
if (!pubSubPublishTopics[options.topicName]) {
|
|
107187
107189
|
pubSubPublishTopics[options.topicName] = this.pubSub.topic(options.topicName, {
|
|
107188
107190
|
batching: {
|
|
107189
|
-
maxMessages:
|
|
107190
|
-
maxMilliseconds:
|
|
107191
|
+
maxMessages: 100,
|
|
107192
|
+
maxMilliseconds: 50
|
|
107191
107193
|
}
|
|
107192
107194
|
});
|
|
107193
107195
|
}
|
|
@@ -107213,10 +107215,10 @@ var PubSubHelper = class extends Runtime {
|
|
|
107213
107215
|
if (options.exportableToBigQuery) {
|
|
107214
107216
|
attributes.bigquery = "yes";
|
|
107215
107217
|
}
|
|
107216
|
-
const result = topic.publishMessage({
|
|
107218
|
+
const result = limit(() => topic.publishMessage({
|
|
107217
107219
|
data: Buffer.from(JSON.stringify(normPayload)),
|
|
107218
107220
|
attributes
|
|
107219
|
-
});
|
|
107221
|
+
}));
|
|
107220
107222
|
promises.push(result);
|
|
107221
107223
|
}
|
|
107222
107224
|
return (await Promise.allSettled(promises)).map((x) => x.status === "fulfilled" ? x.value : null);
|
package/dist/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shushed/helpers",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.184",
|
|
4
4
|
"author": "",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"description": "",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"lodash.omit": "^4.5.0",
|
|
16
16
|
"lodash.pick": "^4.4.0",
|
|
17
17
|
"mime-types": "^3.0.1",
|
|
18
|
+
"p-limit": "^7.1.1",
|
|
18
19
|
"rate-limiter-flexible": "^7.2.0",
|
|
19
20
|
"uuid": "^11.1.0"
|
|
20
21
|
},
|