optimization: can be 10% faster on high traffic
Massimo Melina committed
Mar 31, 2026 at 00:28 UTC
d7ee9f6bcffbd525f83df80467dd4c5af4477683
2 files changed
+3
-3
package.json
+1
-1
@@ -80,7 +80,7 @@
80
},
81
"dependencies": {
82
"@gregoranders/csv": "^0.0.13",
83
- "@rejetto/kvstorage": "^0.17.1",
83
+ "@rejetto/kvstorage": "^0.17.2",
84
"acme-client": "^5.4.0",
85
"busboy": "^1.6.0",
86
"crc-32": "^1.2.2",
src/throttler.ts
+2
-2
@@ -64,8 +64,8 @@ export const throttler: Koa.Middleware = async (ctx, next) => {
64
if (outSpeed || !closed)
65
conn[SymTimeout] = setTimeout(update, DELAY)
66
}, DELAY, { leading: true, maxWait:DELAY })
67
- ts.on('sent', async (n: number) => {
68
- await totalSent.ready()
67
+ await totalSent.ready()
68
+ ts.on('sent', n => {
69
totalSent.set(x => x + n)
70
update()
71
})