Skip to content

Commit 3810f82

Browse files
committed
feat: Add debug logging to getOptimalClient for client state, workflow affinity, and priority comparison.
1 parent 1272c97 commit 3810f82

File tree

5 files changed

+11
-5
lines changed

5 files changed

+11
-5
lines changed

dist/multipool/client-registry.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/multipool/client-registry.js

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/multipool/client-registry.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "comfyui-node",
3-
"version": "1.8.0",
3+
"version": "1.8.1",
44
"description": "ComfyUI Node.js Client",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

src/multipool/client-registry.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,12 @@ export class ClientRegistry {
7474
// Filter clients based on workflow affinity
7575
const suitableClients: EnhancedClient[] = [];
7676
for (const client of this.clients.values()) {
77+
const hasAffinity = client.workflowAffinity && client.workflowAffinity.has(workflowHash);
78+
this.events.emitEvent({ type: "debug", payload: `[getOptimalClient] Client ${client.nodeName}: state=${client.state}, hasAffinity=${hasAffinity}, priority=${client.priority}` });
7779
if (client.state !== "idle") {
7880
continue;
7981
}
80-
if (client.workflowAffinity && client.workflowAffinity.has(workflowHash)) {
82+
if (hasAffinity) {
8183
suitableClients.push(client);
8284
}
8385
}
@@ -93,6 +95,7 @@ export class ClientRegistry {
9395
suitableClients.sort((a, b) => {
9496
const priorityA = priorityOverrides?.get(a.url) ?? a.priority ?? 0;
9597
const priorityB = priorityOverrides?.get(b.url) ?? b.priority ?? 0;
98+
this.events.emitEvent({ type: "debug", payload: `[getOptimalClient] Comparing ${a.nodeName}(${priorityA}) vs ${b.nodeName}(${priorityB})` });
9699
return priorityB - priorityA; // higher priority first
97100
});
98101

0 commit comments

Comments
 (0)