Function
main
({ len, n, c, duration })
Source from the content-addressed store, hash-verified
| 18 | }); |
| 19 | |
| 20 | function main({ len, n, c, duration }) { |
| 21 | const http = require('http'); |
| 22 | const chunk = Buffer.alloc(len, '8'); |
| 23 | |
| 24 | const server = http.createServer((req, res) => { |
| 25 | function send(left) { |
| 26 | if (left === 0) return res.end(); |
| 27 | res.write(chunk); |
| 28 | setTimeout(() => { |
| 29 | send(left - 1); |
| 30 | }, 0); |
| 31 | } |
| 32 | send(n); |
| 33 | }); |
| 34 | |
| 35 | server.listen(0, () => { |
| 36 | bench.http({ |
| 37 | connections: c, |
| 38 | duration, |
| 39 | port: server.address().port, |
| 40 | }, () => { |
| 41 | server.close(); |
| 42 | }); |
| 43 | }); |
| 44 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected
Used in the wild real call sites across dependent graphs
searching dependent graphs…