tom-pytel edited a comment on pull request #20:
URL: https://github.com/apache/skywalking-nodejs/pull/20#issuecomment-752964822
> > Hopefully this can be extracted as an individual reusable module /
class. Also note not to copy the codes from on-finished because of licensing
issues.
>
> Actually not even extract anything, I think its just adding a listener on
request socket error or close and removing the `stopIfNotStopped()` in response
listener.
Actually its as simple as removing `stopIfNotStopped()` on line 97 since the
end of the request is already hooked to stop:
```js
request.on('close', stopIfNotStopped);
request.on('abort', () => (span.errored = true, stopIfNotStopped()));
request.on('error', (err) => (span.error(err), stopIfNotStopped()));
```
It is not perfect yet since `local` and `/doall` still end earlier but
looking into it.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]