3168
referenceTime time.Time,
3169
callback func(handler NodePureTask, taskAttributes TaskAttributes, taskInstance any) (bool, error),
3171
>
chasmContext := NewContext(context.Background(), n)
3172
>
3173
>
// Because tree structure may change during the processing,
3174
>
// we first gather all nodes that have pure tasks that are ready for execution.
3175
>
var componentToProcess []any
3176
>
for _, node := range n.andAllChildren() {
3177
>
// Skip nodes that aren't serialized yet.
3178
>
if node.serializedNode == nil || node.serializedNode.Metadata == nil {
3179
continue
3180
}
3181
3182
>
componentAttr := node.serializedNode.Metadata.GetComponentAttributes()
tree.go
3183
>
// Skip nodes that aren't components.
3184
>
if componentAttr == nil {
3185
continue
3186
}
3187
3188
>
if len(componentAttr.PureTasks) == 0 {
tree.go
3189
continue
3190
}
3191
3192
>
if !isComponentTaskExpired(referenceTime, componentAttr.PureTasks[0]) {
tree.go
3193
>
continue
3194
}
3195
3196
// This component node as a pure task that's ready to execute
3197
>
err := node.prepareComponentValue(chasmContext)
tree.go
3198
>
if err != nil {
3199
return err
3200
}
3201
3202
>
componentToProcess = append(componentToProcess, node.value)
tree.go
3203
}
3204
3205
>
for _, component := range componentToProcess {
tree.go
3206
>
3207
>
// Node get deleted when previous pure tasks of other components are executed.
3208
>
node, ok := n.valueToNode[component]
3209
>
if !ok {
3210
>
continue
3211
}
3212
3213
>
componentAttr := node.serializedNode.Metadata.GetComponentAttributes()
tree.go
3214
>
3215
>
for _, task := range componentAttr.GetPureTasks() {
3216
>
if !isComponentTaskExpired(referenceTime, task) {
3217
break
3218
}