Skip to content

Commit

Permalink
Fix list task list partition issue in matching (cadence-workflow#3256)
Browse files Browse the repository at this point in the history
  • Loading branch information
meiliang86 authored May 19, 2020
1 parent 1bef70a commit af7583c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 5 additions & 2 deletions service/frontend/workflowHandler.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Uber Technologies, Inc.
// Copyright (c) 2017-2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -3228,7 +3228,10 @@ func (wh *WorkflowHandler) DescribeTaskList(
}

// ListTaskListPartitions returns all the partition and host for a taskList
func (wh *WorkflowHandler) ListTaskListPartitions(ctx context.Context, request *gen.ListTaskListPartitionsRequest) (resp *gen.ListTaskListPartitionsResponse, retError error) {
func (wh *WorkflowHandler) ListTaskListPartitions(
ctx context.Context,
request *gen.ListTaskListPartitionsRequest,
) (resp *gen.ListTaskListPartitionsResponse, retError error) {
defer log.CapturePanic(wh.GetLogger(), &retError)

scope, sw := wh.startRequestProfileWithDomain(metrics.FrontendListTaskListPartitionsScope, request)
Expand Down
12 changes: 6 additions & 6 deletions service/matching/matchingEngine.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) 2017 Uber Technologies, Inc.
// Copyright (c) 2017-2020 Uber Technologies, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -600,7 +600,10 @@ func (e *matchingEngineImpl) ListTaskListPartitions(
return &resp, nil
}

func (e *matchingEngineImpl) listTaskListPartitions(request *m.ListTaskListPartitionsRequest, taskListType int) ([]*workflow.TaskListPartitionMetadata, error) {
func (e *matchingEngineImpl) listTaskListPartitions(
request *m.ListTaskListPartitionsRequest,
taskListType int,
) ([]*workflow.TaskListPartitionMetadata, error) {
partitions, err := e.getAllPartitions(
request.GetDomain(),
*request.TaskList,
Expand All @@ -609,11 +612,8 @@ func (e *matchingEngineImpl) listTaskListPartitions(request *m.ListTaskListParti
if err != nil {
return nil, err
}
partitionHostInfo := make([]*workflow.TaskListPartitionMetadata, len(partitions))

if err != nil {
return nil, err
}
var partitionHostInfo []*workflow.TaskListPartitionMetadata
for _, partition := range partitions {
if host, err := e.getHostInfo(partition); err != nil {
partitionHostInfo = append(partitionHostInfo,
Expand Down

0 comments on commit af7583c

Please sign in to comment.