We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Say I have the following activity code
func (a *Activities) MyActivity(ctx) (out, error)( g, gctx := errgroup.WithContext(ctx) g.SetLimit(4) for _, batch := range batches { batch := batch g.Go(func() error { activity.RecordHeartbeat(gctx) // Goroutine logic }) } if err := g.Wait(); err != nil { return nil, err } for _, item := range array { activity.RecordHeartbeat(ctx) // Additional logic } }
I expect heartbeat to get sent out to the server and my activity to NOT time out
Activity timed out with activity Heartbeat timeout
activity Heartbeat timeout
This is because g.Wait() cancels gctx but gctx is still referenced in SDK Heartbeat function's goroutine https://github.com/temporalio/sdk-go/blob/master/internal/internal_task_handlers.go#L2031. Due to the batch heartbeat logic, gctx was used after g.Wait() had finished in my code and caused a context canceled error when making the call to the server
g.Wait()
gctx
Heartbeat
context canceled
I could change activity.RecordHeartbeat(gctx) to activity.RecordHeartbeat(ctx) but wonder if SDK can avoid this pitfall by using context.Background()
activity.RecordHeartbeat(gctx)
activity.RecordHeartbeat(ctx)
The text was updated successfully, but these errors were encountered:
Talked offline discussed we should:
RecordHeartbeat
Sorry, something went wrong.
No branches or pull requests
Expected Behavior
Say I have the following activity code
I expect heartbeat to get sent out to the server and my activity to NOT time out
Actual Behavior
Activity timed out with
activity Heartbeat timeout
This is because
g.Wait()
cancelsgctx
butgctx
is still referenced in SDKHeartbeat
function's goroutine https://github.com/temporalio/sdk-go/blob/master/internal/internal_task_handlers.go#L2031. Due to the batch heartbeat logic,gctx
was used afterg.Wait()
had finished in my code and caused acontext canceled
error when making the call to the serverI could change
activity.RecordHeartbeat(gctx)
toactivity.RecordHeartbeat(ctx)
but wonder if SDK can avoid this pitfall by using context.Background()Steps to Reproduce the Problem
Specifications
The text was updated successfully, but these errors were encountered: