Failed task go immediately into the buffer state with the error.

This commit is contained in:
Marc-Andre Ferland 2022-10-14 04:47:13 -04:00
parent 476e938d23
commit f91c77bdc6

View File

@ -541,12 +541,13 @@ async function doMakeImage(task) {
throw new Error('Connexion with server lost.')
}
} while (serverState.time > (Date.now() - (10 * 1000)) && serverState.task !== renderRequest.task)
if (serverState.session !== 'pending' && serverState.session !== 'running') {
if (serverState.session !== 'pending' && serverState.session !== 'running' && serverState.session !== 'buffer') {
throw new Error('Unexpected server task state: ' + serverState.session || 'Undefined')
}
do { // Wait for task to start on server.
while (serverState?.session === 'pending') {
// Wait for task to start on server.
await asyncDelay(1500)
} while (serverState?.session === 'pending')
}
// Task started!
res = await fetch(renderRequest.stream, {