Skip to content

benchmark: fix async-resource benchmark

In the benchmark, because it performs asynchronous operations before writing its HTTP replies, the underlying socket can be closed by the peer before the response is written. Since 28e6626c, that means that attempting to .end() the HTTP response results in an uncaught exception, breaking the benchmark.

Fix that by checking whether the response object has been destroyed or not before attempting to call .end().

https://github.com/nodejs/node/issues/33591

(As noted in the issue, I’m not really happy with this solution.)

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading