sd: cancel image generation on client disconnect#2318
Conversation
6c411d3 to
063a729
Compare
063a729 to
922cb41
Compare
|
I would argue that the new behavior makes more sense, at least by default, because the image recovering functionality only works with the stable-ui. It won't work with any other API user, or with Lite. Also, a long-running image gen blocks the server from accepting any other gen until it finishes: if we generate a 100-step image by mistake (and again, it could happen with another UI), the only way to stop it is interrupting the server. Cancelling with a client disconnect is what any synchronous, session-less API would expect. The recovery functionality also feels like a stopgap: it doesn't integrate with the rest of the UI (the image isn't included to the gallery, and its metadata isn't recovered). The reconnected client also have to blindly wait for the gen to finish (or save the url, run another gen, and refresh the url as soon as it begin - assuming it would work with the current id handling). Anyway, since the functionality is tied to client support, it seems to me its behavior should be triggered by an API field. We configure the stable-ui to send a boolean 'keep generating on disconnect', signalling to the server that the behavior is desired and the client supports it. And stable-ui would persist that flag as a config. |
|
I went ahead and added an API field: #2322 . |

Detects client disconnection on the image generation endpoints, and calls
sd_cancel_generationto avoid running the next steps.LostRuins/stable-ui#25 is still needed for the Cancel button.