Skip to content

Commit

Permalink
Do not return not exists error in history pagination function (cadenc…
Browse files Browse the repository at this point in the history
…e-workflow#5054)

Co-authored-by: David Porter <[email protected]>
  • Loading branch information
Shaddoll and davidporter-id-au authored Jan 4, 2023
1 parent d618e32 commit 747b58e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions common/persistence/historyManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ func (m *historyV2ManagerImpl) readRawHistoryBranch(
if err != nil {
return nil, nil, 0, nil, err
}
// TODO: consider if it's possible to remove this branch
if len(resp.History) == 0 && len(request.NextPageToken) == 0 {
return nil, nil, 0, nil, &types.EntityNotExistsError{Message: "Workflow execution history not found."}
}
Expand Down
9 changes: 9 additions & 0 deletions common/persistence/persistence-utils/historyManagerUtil.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package persistenceutils

import (
"context"
"errors"

"github.com/uber/cadence/common/cache"
"github.com/uber/cadence/common/persistence"
Expand Down Expand Up @@ -125,6 +126,10 @@ func PaginateHistory(
if byBatch {
response, err := historyV2Mgr.ReadHistoryBranchByBatch(ctx, req)
if err != nil {
var e *types.EntityNotExistsError
if errors.As(err, &e) {
return nil, nil, nil, 0, nil
}
return nil, nil, nil, 0, err
}

Expand All @@ -136,6 +141,10 @@ func PaginateHistory(
} else {
response, err := historyV2Mgr.ReadHistoryBranch(ctx, req)
if err != nil {
var e *types.EntityNotExistsError
if errors.As(err, &e) {
return nil, nil, nil, 0, nil
}
return nil, nil, nil, 0, err
}

Expand Down

0 comments on commit 747b58e

Please sign in to comment.