-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix: Schedule the execution of the finish to let all the spans being closed first #3022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
size-limit report
|
Is there another option? |
@lobsterkatie the code is for the node.js, it has |
@xr0master I was thinking about this solution as well. |
@kamilogorek it makes sense. I wonder what the gap is between the finish event and the closing event. Perhaps it could have been ignored. However, the decision to use |
@xr0master I performed some tests for
quick hacky test implementationconst http = require("http");
const { performance } = require("perf_hooks");
http
.get("http://en6m65p7lz2gi.x.pipedream.net", (resp) => {
resp.on("data", (d) => {});
let end;
resp.on("end", () => {
const now = performance.now();
end = now;
console.log(`[get] end: ${now}`);
setImmediate(() => {
const now = performance.now();
console.log(`[get] setImmediate: ${now}`);
console.log(`[get] setImmediate delta: ${now - end}`);
});
});
resp.on("close", () => {
const now = performance.now();
console.log(`[get] close: ${now}`);
console.log(`[get] close delta: ${now - end}`);
});
})
.on("error", (err) => {
console.log("Error: " + err.message);
});
const req = http
.request(
{
host: "en6m65p7lz2gi.x.pipedream.net",
method: "POST",
},
(resp) => {
resp.on("data", (d) => {});
let end;
resp.on("end", () => {
const now = performance.now();
end = now;
console.log(`[post] end: ${now}`);
setImmediate(() => {
const now = performance.now();
console.log(`[post] setImmediate: ${now}`);
console.log(`[post] setImmediate delta: ${now - end}`);
});
});
resp.on("close", () => {
const now = performance.now();
console.log(`[post] close: ${now}`);
console.log(`[post] close delta: ${now - end}`);
});
}
)
.on("error", (error) => {
console.error(error);
});
req.write(
JSON.stringify({
todo: "Buy the milk",
})
);
req.end(); |
@kamilogorek Thanks for the testing and results. This is very useful. |
Fixes #3001