@kaspernj/api-maker 1.0.369 → 1.0.371
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 +2 -1
- package/src/commands-pool.mjs +17 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kaspernj/api-maker",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.371",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "index.js",
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
"replaceall": ">= 0.1.6",
|
|
38
38
|
"set-state-compare": "^1.0.42",
|
|
39
39
|
"spark-md5": "^3.0.2",
|
|
40
|
+
"stacktrace-parser": "^0.1.10",
|
|
40
41
|
"strftime": ">= 0.10.0",
|
|
41
42
|
"uniqunize": "^1.0.1",
|
|
42
43
|
"wake-event": ">= 0.0.1"
|
package/src/commands-pool.mjs
CHANGED
|
@@ -208,8 +208,24 @@ export default class ApiMakerCommandsPool {
|
|
|
208
208
|
return false
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
+
// Try to batch calls to backend while waiting for the event-queue-call to clear any other jobs before the request and reset on every flush call
|
|
212
|
+
// If only waiting a single time, then other event-queue-jobs might be before us and queue other jobs that might queue calls to the backend
|
|
211
213
|
setFlushTimeout() {
|
|
214
|
+
this.flushTriggerCount = 0
|
|
212
215
|
this.clearTimeout()
|
|
213
|
-
this.
|
|
216
|
+
this.flushTrigger()
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
flushTrigger = () => {
|
|
220
|
+
if (this.flushTriggerCount >= 10) {
|
|
221
|
+
this.flush()
|
|
222
|
+
} else {
|
|
223
|
+
this.flushTriggerCount++
|
|
224
|
+
this.flushTriggerQueue()
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
flushTriggerQueue() {
|
|
229
|
+
this.flushTimeout = setTimeout(this.flushTrigger, 0)
|
|
214
230
|
}
|
|
215
231
|
}
|