0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-29 07:00:59 +01:00
nodejs/benchmark/async_hooks
Anna Henningsen f5ed5fe068
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 28e6626ce7, 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

PR-URL: https://github.com/nodejs/node/pull/33642
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
2020-06-06 17:36:52 +02:00
..
async-resource-vs-destroy.js benchmark: fix async-resource benchmark 2020-06-06 17:36:52 +02:00
gc-tracking.js async_hooks: move to lazy destroy hook registration in AsyncResource 2020-04-06 16:14:43 +02:00
http-server.js benchmark: add test and all options and improve errors" 2020-03-09 22:35:53 +01:00
promises.js async_hooks: move PromiseHook handler to JS 2020-05-09 07:52:22 +02:00