mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-25 15:55:18 +00:00
Lower timeout and fix for colab.
This commit is contained in:
parent
68a1ac7746
commit
93d84e3b9c
@ -480,11 +480,21 @@ document.addEventListener('drop', (event) => {
|
|||||||
prompt_file_load(file);
|
prompt_file_load(file);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
function updateStatus(data) {
|
function updateStatus(data) {
|
||||||
document.getElementById("queuesize").innerHTML = "Queue size: " + (data ? data.exec_info.queue_remaining : "ERR");
|
document.getElementById("queuesize").innerHTML = "Queue size: " + (data ? data.exec_info.queue_remaining : "ERR");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//fix for colab and other things that don't support websockets.
|
||||||
|
function manually_fetch_queue() {
|
||||||
|
fetch('/prompt')
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
updateStatus(data.exec_info.queue_remaining);
|
||||||
|
}).catch((response) => {updateStatus(null)});
|
||||||
|
}
|
||||||
|
|
||||||
let ws;
|
let ws;
|
||||||
function createSocket(isReconnect) {
|
function createSocket(isReconnect) {
|
||||||
if(ws) return;
|
if(ws) return;
|
||||||
@ -501,14 +511,16 @@ document.addEventListener('drop', (event) => {
|
|||||||
|
|
||||||
ws.addEventListener("error", () => {
|
ws.addEventListener("error", () => {
|
||||||
if(ws) ws.close();
|
if(ws) ws.close();
|
||||||
|
manually_fetch_queue();
|
||||||
});
|
});
|
||||||
|
|
||||||
ws.addEventListener("close", () => {
|
ws.addEventListener("close", () => {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
ws = null;
|
ws = null;
|
||||||
createSocket(true);
|
createSocket(true);
|
||||||
}, 1000);
|
}, 300);
|
||||||
if(opened) {
|
if(opened) {
|
||||||
|
updateStatus(null);
|
||||||
showModal("Reconnecting...");
|
showModal("Reconnecting...");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user