Skip to content

Commit

Permalink
Fix go routine leak
Browse files Browse the repository at this point in the history
  • Loading branch information
govargo committed Jun 28, 2024
1 parent 262b274 commit 1b0822e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions frontend/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,19 @@ func streamAssignments(ctx context.Context, assignments chan *pb.Assignment, err
errs <- fmt.Errorf("error getting assignment stream: %w", err)
return
}
for {

var assignment *pb.Assignment
for assignment.GetConnection() == "" {
resp, err := stream.Recv()
if err != nil {
errs <- fmt.Errorf("error streaming assignment: %w", err)
return
}
assignments <- resp.Assignment
assignment = resp.Assignment
}

assignments <- assignment
log.Printf("Got assignment: %v", assignment)
}

func connectFrontendServer() (*grpc.ClientConn, error) {
Expand Down

0 comments on commit 1b0822e

Please sign in to comment.