Skip to content

Commit

Permalink
Recognize SDKPriorityUpdateHandling flag
Browse files Browse the repository at this point in the history
Recognize, but do not handle SDKPriorityUpdateHandling flag to avoid unknown flag error.
  • Loading branch information
Quinn-With-Two-Ns committed Feb 29, 2024
1 parent f576425 commit 31f6681
Show file tree
Hide file tree
Showing 3 changed files with 504 additions and 1 deletion.
8 changes: 7 additions & 1 deletion internal/internal_flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ const (
// a workflow task response's command set to order messages with respect to
// commands.
SDKFlagProtocolMessageCommand = 3
SDKFlagUnknown = math.MaxUint32
// SDKPriorityUpdateHandling uses the new priority handling for updates.
// This SDK version does not understand the new priority handling, this is just to avoid
// unknown flag errors.
SDKPriorityUpdateHandling = 4
SDKFlagUnknown = math.MaxUint32
)

func sdkFlagFromUint(value uint32) sdkFlag {
Expand All @@ -57,6 +61,8 @@ func sdkFlagFromUint(value uint32) sdkFlag {
return SDKFlagChildWorkflowErrorExecution
case uint32(SDKFlagProtocolMessageCommand):
return SDKFlagProtocolMessageCommand
case uint32(SDKPriorityUpdateHandling):
return SDKPriorityUpdateHandling
default:
return SDKFlagUnknown
}
Expand Down
8 changes: 8 additions & 0 deletions test/replaytests/replay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,3 +425,11 @@ func (c *captureConverter) FromPayloads(payloads *commonpb.Payloads, valuePtrs .
}
return err
}

func (s *replayTestSuite) TestReplayWorkflowWithSDKPriorityUpdateHandling() {
replayer := worker.NewWorkflowReplayer()
replayer.RegisterWorkflow(Workflow1)

err := replayer.ReplayWorkflowHistoryFromJSONFile(ilog.NewDefaultLogger(), "workflow_with_SDK_priority_flag_set.json")
require.NoError(s.T(), err)
}
Loading

0 comments on commit 31f6681

Please sign in to comment.