3756
validate func(NodeBackend, Context, Component) error,
3757
taskFn func(context.Context, ComponentRef, TaskAttributes, any) error,
3759
>
taskInfo := chasmTask.Info
3760
>
3761
>
defer func() {
3762
>
if rec := recover(); rec != nil {
3763
chasmTask.DeserializedTask = reflect.Value{}
3764
panic(rec) //nolint:forbidigo
3765
}
3766
>
if retErr != nil && !errors.As(retErr, new(*serviceerror.NotFound)) {
tree.go
3767
chasmTask.DeserializedTask = reflect.Value{}
3768
}
3769
}()
3770
3771
>
if !chasmTask.DeserializedTask.IsValid() {
tree.go
3772
>
var err error
3773
>
// TODO: Change physical side effect task to reference logical task and
3774
>
// then use deserializeTaskWithCache as well.
3775
>
chasmTask.DeserializedTask, err = deserializeTask(registrableTask, taskInfo.Data)
3776
>
if err != nil {
3777
return err
3778
}
3779
}
3780
>
taskValue := chasmTask.DeserializedTask
tree.go
3781
>
3782
>
taskAttributes := TaskAttributes{
3783
>
ScheduledTime: chasmTask.GetVisibilityTime(),
3784
>
Destination: chasmTask.Destination,
3785
>
}
3786
>
3787
>
ref := ComponentRef{
3788
>
ExecutionKey: executionKey,
3789
>
archetypeID: ArchetypeID(taskInfo.GetArchetypeId()),
3790
>
executionLastUpdateVT: taskInfo.ComponentLastUpdateVersionedTransition,
3791
>
componentPath: taskInfo.Path,
3792
>
componentInitialVT: taskInfo.ComponentInitialVersionedTransition,
3793
>
3794
>
// Validate the Ref only once it is accessed by the task's handler.
3795
>
validationFn: makeValidationFn(registrableTask, validate, chasmTask.Attempt, taskAttributes, taskValue),
3796
>
}
3797
>
3798
>
ctx = newContextWithOperationIntent(ctx, OperationIntentProgress)
3799
>
3800
>
defer log.CapturePanic(n.logger, &retErr)
3801
>
3802
>
return taskFn(ctx, ref, taskAttributes, taskValue.Interface())
3803
}
3804