Skip to content

Commit

Permalink
Fix long poll cancellation (#6538)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaddoll authored Dec 3, 2024
1 parent 291be5d commit 5f579dd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions client/matching/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
4 changes: 3 additions & 1 deletion service/frontend/api/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 5f579dd

Please sign in to comment.