Rebuild: edge:node --max-mbit caps a node's download
For workers on a shared line (poweredge-kantoor: 160 Mbit/s): the range stream is read at most at the cap, TCP holds the coordinator back. The cap is the node's, split over its processes (also EDGE_MAX_MBIT). REBUILD.md: where workers run (connections set the speed; remote workers take CPU off homelab). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
104248d8a3
commit
42b6cac3ee
5 files changed
+67
-4
No files matched your search
@@ -0,0 +1,16 @@
|
||||
import { test } from '@japa/runner'
|
||||
import { throttle } from '#lib/edge/index'
|
||||
|
||||
test.group('edge / throttle', () => {
|
||||
test('passes everything on, at most the given rate after the first second', async ({ assert }) => {
|
||||
const pieces = Array.from({ length: 30 }, (_, i) => new Uint8Array(1000).fill(i))
|
||||
const started = Date.now()
|
||||
const out: Uint8Array[] = []
|
||||
// 30,000 bytes at 20,000 B/s: the first 20,000 at once, the rest over ~0.5 s.
|
||||
for await (const piece of throttle(pieces, 20_000)) out.push(piece)
|
||||
const seconds = (Date.now() - started) / 1000
|
||||
assert.deepEqual(out, pieces)
|
||||
assert.isAtLeast(seconds, 0.45)
|
||||
assert.isBelow(seconds, 1.2)
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user