mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-12-25 00:19:09 +01:00
Clone the complete task object instead of only reqBody.
Avoids altering already completed tasks for reruns.
This commit is contained in:
parent
87122ce211
commit
27e372e38f
@ -630,13 +630,19 @@ async function checkTasks() {
|
|||||||
task['taskStatusLabel'].className += " activeTaskLabel"
|
task['taskStatusLabel'].className += " activeTaskLabel"
|
||||||
|
|
||||||
const genSeeds = Boolean(typeof task.reqBody.seed !== 'number' || (task.reqBody.seed === task.seed && task.numOutputsTotal > 1))
|
const genSeeds = Boolean(typeof task.reqBody.seed !== 'number' || (task.reqBody.seed === task.seed && task.numOutputsTotal > 1))
|
||||||
|
const startSeed = task.reqBody.seed || task.seed
|
||||||
for (let i = 0; i < task.batchCount; i++) {
|
for (let i = 0; i < task.batchCount; i++) {
|
||||||
if (task.numOutputsTotal > 1) {
|
if (task.batchCount > 1) {
|
||||||
// Each output render need it own instance of reqBody to avoid altering the other runs after they are completed.
|
// Each output render batch needs it's own task instance to avoid altering the other runs after they are completed.
|
||||||
task.reqBody = Object.assign({}, task.reqBody)
|
task = Object.assign({}, task, {
|
||||||
|
reqBody: Object.assign({}, task.reqBody)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
if (genSeeds) {
|
if (genSeeds) {
|
||||||
task.reqBody.seed = task.seed + (i * task.reqBody['num_outputs'])
|
task.reqBody.seed = startSeed + (i * task.reqBody.num_outputs)
|
||||||
|
task.seed = task.reqBody.seed
|
||||||
|
} else if (task.seed !== task.reqBody.seed) {
|
||||||
|
task.seed = task.reqBody.seed
|
||||||
}
|
}
|
||||||
|
|
||||||
let success = await doMakeImage(task)
|
let success = await doMakeImage(task)
|
||||||
|
Loading…
Reference in New Issue
Block a user