From dc8589672c0db62b2ec2ad0ed71125375c9dec72 Mon Sep 17 00:00:00 2001 From: bymyself Date: Mon, 23 Jun 2025 05:29:50 -0700 Subject: [PATCH] fix: logs stops listening after 1st of multiple queue tasks --- src/composables/useServerLogs.ts | 4 +++- src/stores/comfyManagerStore.ts | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/composables/useServerLogs.ts b/src/composables/useServerLogs.ts index a7a5e3f02..deb0204a7 100644 --- a/src/composables/useServerLogs.ts +++ b/src/composables/useServerLogs.ts @@ -93,7 +93,9 @@ export const useServerLogs = (options: UseServerLogsOptions) => { stopLogs = null stopTaskStarted = null stopTaskDone = null - await api.subscribeLogs(false) + // TODO: move subscribe/unsubscribe logs to useManagerQueue. Subscribe when task starts if not already subscribed. + // Unsubscribe ONLY when there are no tasks running or queued up and the only remaining task finishes. + // await api.subscribeLogs(false) } if (immediate) { diff --git a/src/stores/comfyManagerStore.ts b/src/stores/comfyManagerStore.ts index 76448b2af..74c722aa3 100644 --- a/src/stores/comfyManagerStore.ts +++ b/src/stores/comfyManagerStore.ts @@ -178,8 +178,9 @@ export const useComfyManagerStore = defineStore('comfyManager', () => { taskName: string ) => { const taskId = uuidv4() - const { startListening, logs } = useServerLogs({ - ui_id: taskId + const { logs } = useServerLogs({ + ui_id: taskId, + immediate: true }) try { @@ -189,7 +190,6 @@ export const useComfyManagerStore = defineStore('comfyManager', () => { // Prepare logging hook taskLogs.value.push({ taskName, taskId, logs: logs.value }) - await startListening() // Queue the task to the server await task(taskId)