Skip to content

Commit

Permalink
Move wk.Stop() to context cancel.
Browse files Browse the repository at this point in the history
  • Loading branch information
lostluck committed Sep 18, 2023
1 parent 3024ec2 commit 6dc03eb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 2 additions & 0 deletions sdks/go/pkg/beam/runners/prism/internal/environments.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ func externalEnvironment(ctx context.Context, ep *pipepb.ExternalPayload, wk *wo
pool.StopWorker(context.Background(), &fnpb.StopWorkerRequest{
WorkerId: wk.ID,
})
wk.Stop()
}

func dockerEnvironment(ctx context.Context, logger *slog.Logger, dp *pipepb.DockerPayload, wk *worker.W, artifactEndpoint string) error {
Expand Down Expand Up @@ -170,6 +171,7 @@ func dockerEnvironment(ctx context.Context, logger *slog.Logger, dp *pipepb.Dock
// Start goroutine to wait on container state.
go func() {
defer cli.Close()
defer wk.Stop()

statusCh, errCh := cli.ContainerWait(ctx, containerID, container.WaitConditionNotRunning)
select {
Expand Down
3 changes: 0 additions & 3 deletions sdks/go/pkg/beam/runners/prism/internal/execute.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ func RunPipeline(j *jobservices.Job) {
}
j.SendMsg("pipeline completed " + j.String())

// Stop the worker.
wk.Stop()

j.SendMsg("terminating " + j.String())
j.Done()
}
Expand Down

0 comments on commit 6dc03eb

Please sign in to comment.