Skip to content

Commit

Permalink
chore: address pr comments
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarchaud committed Sep 13, 2020
1 parent 2e2e421 commit 200f457
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugins/node/opentelemetry-plugin-express/src/express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,9 @@ export class ExpressPlugin extends BasePlugin<typeof express> {
if (callbackIdx >= 0) {
arguments[callbackIdx] = function () {
if (spanHasEnded === false) {
span.end();
spanHasEnded = true;
req.res?.removeListener('finish', onResponseFinish);
span.end();
}
if (!(req.route && arguments[0] instanceof Error)) {
(req[_LAYERS_STORE_PROPERTY] as string[]).pop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ describe('Express Plugin', () => {
const router = express.Router();
app.use('/toto', router);
router.get('/:id', (req, res) => {
setTimeout(() => {
return res.status(200).end();
}, 5);
setImmediate(() => {
res.status(200).end();
});
});
const server = http.createServer(app);
await new Promise(resolve => server.listen(0, resolve));
Expand Down

0 comments on commit 200f457

Please sign in to comment.