fix request armageddon on flow status update for inner flows

This commit is contained in:
Ruben Fiszel
2023-08-22 21:53:44 +02:00
parent 58bb19a447
commit 2c59eeb750
@@ -17,6 +17,7 @@
import JobArgs from './JobArgs.svelte'
import { Loader2 } from 'lucide-svelte'
import FlowStatusWaitingForEvents from './FlowStatusWaitingForEvents.svelte'
import { deepEqual } from 'fast-equals'
const dispatch = createEventDispatcher()
@@ -101,17 +102,21 @@
mod.type === FlowStatusModule.type.WAITING_FOR_EXECUTOR &&
localFlowModuleStates[mod.id ?? '']?.scheduled_for == undefined
) {
console.debug('updating', mod.job)
JobService.getJob({
workspace: workspaceId ?? $workspaceStore ?? '',
id: mod.job ?? ''
}).then((job) => {
localFlowModuleStates[mod.id ?? ''] = {
const newState = {
type: mod.type,
scheduled_for: job?.['scheduled_for'],
job_id: job?.id,
parent_module: mod['parent_module'],
args: job?.args
}
if (!deepEqual(newState, localFlowModuleStates[mod.id ?? ''])) {
localFlowModuleStates[mod.id ?? ''] = newState
}
})
}
})