Skip to content

Commit

Permalink
Fixed issue with greet deadline example to use context.DeadlineExceed…
Browse files Browse the repository at this point in the history
…ed instead of context.Cancelled
  • Loading branch information
Maneesh Chaturvedi committed May 6, 2020
1 parent cd2673c commit 0caa50f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion greet/greet_server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (*server) GreetEveryone(stream greetpb.GreetService_GreetEveryoneServer) er
func (*server) GreetWithDeadline(ctx context.Context, req *greetpb.GreetWithDeadlineRequest) (*greetpb.GreetWithDeadlineResponse, error) {
fmt.Printf("GreetWithDeadline function was invoked with %v\n", req)
for i := 0; i < 3; i++ {
if ctx.Err() == context.Canceled {
if ctx.Err() == context.DeadlineExceeded {
// the client canceled the request
fmt.Println("The client canceled the request!")
return nil, status.Error(codes.Canceled, "the client canceled the request")
Expand Down

0 comments on commit 0caa50f

Please sign in to comment.