Skip to content

Commit

Permalink
fix a bug about graph changing
Browse files Browse the repository at this point in the history
  • Loading branch information
tzwm committed Jan 4, 2024
1 parent 42f23f9 commit 70d184e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@ function drawText(ctx, text) {
app.registerExtension({
name: "ComfyUI.Profiler",
async setup() {
const nodes = app.graph._nodes;
api.addEventListener("profiler", (event) => {
const data = event.detail;
const node = nodes.find((n) => n.id.toString() == data.node);
const node = app.graph._nodes.find((n) => n.id.toString() == data.node);
if (node) {
node.profilingTime = `${data.current_time.toFixed(2)}s`;
}
});

},
async afterConfigureGraph() {
const nodes = app.graph._nodes;
api.addEventListener("execution_start", (_) => {
nodes.forEach(n => n.profilingTime = '');
});
Expand All @@ -46,5 +49,5 @@ app.registerExtension({
return ret;
};
});
},
}
});

0 comments on commit 70d184e

Please sign in to comment.