Skip to content

Commit

Permalink
minor updates on log message, comments, and request type
Browse files Browse the repository at this point in the history
Signed-off-by: kaibocai <kaibocai@microsoft.com>

update method name

Signed-off-by: kaibocai <kaibocai@microsoft.com>
  • Loading branch information
kaibocai committed Dec 18, 2023
1 parent 2517e86 commit ab1d3f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pkg/runtime/wfengine/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (be *actorBackend) CreateOrchestrationInstance(ctx context.Context, e *back
NewInvokeMethodRequest(CreateWorkflowInstanceMethod).
WithActor(be.config.workflowActorType, workflowInstanceID).
WithRawDataBytes(requestBytes).
WithContentType(invokev1.OctetStreamContentType)
WithContentType(invokev1.JSONContentType)
defer req.Close()

resp, err := be.actors.Call(ctx, req)
Expand Down
12 changes: 6 additions & 6 deletions pkg/runtime/wfengine/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ func (wf *workflowActor) createWorkflowInstance(ctx context.Context, actorID str
switch reuseIDPolicy.GetAction() {
case api.REUSE_ID_ACTION_IGNORE:
// Log an warning message and ignore creating new instance
wfLogger.Warnf("An instance with ID '%s' already exists; dropping duplicate create request", actorID)
wfLogger.Warnf("Workflow actor '%s': ignoring request to recreate the current workflow instance", actorID)
return nil
case api.REUSE_ID_ACTION_TERMINATE:
// terminate existing instance
if err := wf.cleanupOrchestrationStateInternal(ctx, actorID, state, false); err != nil {
if err := wf.cleanupWorkflowStateInternal(ctx, actorID, state, false); err != nil {
return fmt.Errorf("failed to terminate existing instance with ID '%s'", actorID)

Check warning on line 220 in pkg/runtime/wfengine/workflow.go

View check run for this annotation

Codecov / codecov/patch

pkg/runtime/wfengine/workflow.go#L220

Added line #L220 was not covered by tests
}

Expand Down Expand Up @@ -264,9 +264,9 @@ func (wf *workflowActor) scheduleWorkflowStart(ctx context.Context, actorID stri
}

// This method cleans up a workflow associated with the given actorID
func (wf *workflowActor) cleanupOrchestrationStateInternal(ctx context.Context, actorID string, state *workflowState, requiredAndNotCompleted bool) error {
// Only purge orchestration in the ['COMPLETED', 'FAILED', 'TERMINATED'] statuses,
// indicating that the orchestration is completed.
func (wf *workflowActor) cleanupWorkflowStateInternal(ctx context.Context, actorID string, state *workflowState, requiredAndNotCompleted bool) error {
// If the workflow is required to complete but it's not yet completed then return [ErrNotCompleted]
// This check is used by purging workflow
if requiredAndNotCompleted {
return api.ErrNotCompleted

Check warning on line 271 in pkg/runtime/wfengine/workflow.go

View check run for this annotation

Codecov / codecov/patch

pkg/runtime/wfengine/workflow.go#L271

Added line #L271 was not covered by tests
}
Expand Down Expand Up @@ -332,7 +332,7 @@ func (wf *workflowActor) purgeWorkflowState(ctx context.Context, actorID string)
return api.ErrInstanceNotFound
}
runtimeState := getRuntimeState(actorID, state)
return wf.cleanupOrchestrationStateInternal(ctx, actorID, state, true && !runtimeState.IsCompleted())
return wf.cleanupWorkflowStateInternal(ctx, actorID, state, !runtimeState.IsCompleted())
}

func (wf *workflowActor) addWorkflowEvent(ctx context.Context, actorID string, historyEventBytes []byte) error {
Expand Down

0 comments on commit ab1d3f1

Please sign in to comment.