From 1cd8447d9c04f3e6c0220a3ea6c10d2d652fa818 Mon Sep 17 00:00:00 2001 From: Zijian Date: Mon, 2 Dec 2024 21:58:19 +0000 Subject: [PATCH] Fix long poll cancellation --- client/matching/client.go | 4 ++++ service/frontend/api/handler.go | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/client/matching/client.go b/client/matching/client.go index cad61feea03..43f39c34442 100644 --- a/client/matching/client.go +++ b/client/matching/client.go @@ -152,6 +152,8 @@ func (c *clientImpl) PollForActivityTask( partition, resp.LoadBalancerHints, ) + // caller needs to know the actual partition for cancelling long poll, so modify the request to pass this information + request.PollRequest.TaskList.Name = partition return resp, nil } @@ -191,6 +193,8 @@ func (c *clientImpl) PollForDecisionTask( partition, resp.LoadBalancerHints, ) + // caller needs to know the actual partition for cancelling long poll, so modify the request to pass this information + request.PollRequest.TaskList.Name = partition return resp, nil } diff --git a/service/frontend/api/handler.go b/service/frontend/api/handler.go index 48fb232ba93..f40ff202bda 100644 --- a/service/frontend/api/handler.go +++ b/service/frontend/api/handler.go @@ -365,6 +365,8 @@ func (wh *WorkflowHandler) PollForActivityTask( tag.Error(err)) return nil, err } + // Must be cancellation error. Doesn't matter what we return here. Client already went away. + return nil, nil } return &types.PollForActivityTaskResponse{ TaskToken: matchingResp.TaskToken, @@ -501,7 +503,7 @@ func (wh *WorkflowHandler) PollForDecisionTask( return nil, err } - // Must be cancellation error. Does'nt matter what we return here. Client already went away. + // Must be cancellation error. Doesn't matter what we return here. Client already went away. return nil, nil }