Hi, My workflow which has the “workflow.Sleep” as below:
func SendMessageWorkflow(workflowCtx workflow.Context, message MessageVO) (res string, err error) {
ao := workflow.ActivityOptions{
StartToCloseTimeout: time.Minute,
}
workflowCtx = workflow.WithActivityOptions(workflowCtx, ao)
if message.ExecDuration > 0 {
// waiting for execute
_ = workflow.Sleep(workflowCtx, message.ExecDuration)
}
logger := workflow.GetLogger(workflowCtx)
logger.Info("SendMessage workflow started", "flowID", message.FlowID)
err = workflow.ExecuteActivity(workflowCtx, SendMessageActivity, message).Get(workflowCtx, &res)
if err != nil {
logger.Error("Activity failed.", "Error", err)
return "", err
}
return res, nil
}
but it will show the below error stacktrace when invoke the workflow.Sleep method. what is the wrong with the code? could someone point out?
coroutine root [blocked on chan-1.Receive]:
go.temporal.io/sdk/internal.(*futureImpl).Get(0xc000c82eb0, {0x29b3540, 0xc000b4b560}, {0x0?, 0x0})
/home/ricky/go/pkg/mod/go.temporal.io/sdk@v1.14.0/internal/internal_workflow.go:310 +0x66
go.temporal.io/sdk/internal.(*workflowEnvironmentInterceptor).Sleep(0x2164040?, {0x29b3540, 0xc000b4b560}, 0xc00015e8b8?)
/home/ricky/go/pkg/mod/go.temporal.io/sdk@v1.14.0/internal/workflow.go:982 +0x43
go.temporal.io/sdk/internal.Sleep({0x29b3540, 0xc000b4b560}, 0x0?)
/home/ricky/go/pkg/mod/go.temporal.io/sdk@v1.14.0/internal/workflow.go:977 +0x79
go.temporal.io/sdk/workflow.Sleep(...)
/home/ricky/go/pkg/mod/go.temporal.io/sdk@v1.14.0/workflow/deterministic_wrappers.go:178
sniper/dao/workflowdao.SendMessageWorkflow({0x29b3540?, 0xc000b4b500?}, {{0xc00015e6d8, 0x14}, 0x2, {0xc00015e7c8, 0x14}, {0xc00015e7e0, 0x14}, {0xc00015e7f8, ...}, ...})
/home/ricky/project/gitlab/dh-fastapp-api-twirp2/dao/workflowdao/sendmessagedao.go:169 +0x8f
reflect.Value.call({0x21e5ea0?, 0x26b9d40?, 0x7f53775df5b8?}, {0x258cd5f, 0x4}, {0xc000b4b530, 0x2, 0x203000?})
/home/ricky/go18/go/src/reflect/value.go:556 +0x845
reflect.Value.Call({0x21e5ea0?, 0x26b9d40?, 0x404d0c?}, {0xc000b4b530, 0x2, 0x2})
/home/ricky/go18/go/src/reflect/value.go:339 +0xbf
go.temporal.io/sdk/internal.executeFunction({0x21e5ea0, 0x26b9d40}, {0xc000484500, 0x2, 0xc0003dac00?})
/home/ricky/go/pkg/mod/go.temporal.io/sdk@v1.14.0/internal/internal_worker.go:1553 +0x136
go.temporal.io/sdk/internal.(*workflowEnvironmentInterceptor).ExecuteWorkflow(0xc000c82d20, {0x29b33f0?, 0xc000c84660}, 0xc000b52c60)
/home/ricky/go/pkg/mod/go.temporal.io/sdk@v1.14.0/internal/workflow.go:419 +0x166
go.temporal.io/sdk/internal.(*workflowExecutor).Execute(0xc000148680, {0x29b33f0, 0xc000c84660}, 0x25?)
/home/ricky/go/pkg/mod/go.temporal.io/sdk@v1.14.0/internal/internal_worker.go:753 +0x292
go.temporal.io/sdk/internal.(*syncWorkflowDefinition).Execute.func1({0x29b3540, 0xc000b4b380})
/home/ricky/go/pkg/mod/go.temporal.io/sdk@v1.14.0/internal/internal_workflow.go:500 +0xcd