Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Annotate versioning behavior per Workflow type #1708

Conversation

antlai-temporal
Copy link
Contributor

What was changed

Provides an alternative mechanism to provide a default versioning behavior per workflow type using workflow registration options.

	w.RegisterWorkflowWithOptions(ts.workflows.Basic, workflow.RegisterOptions{
		VersioningBehavior: workflow.VersioningBehaviorPinned,
	})

Why?

The programmatic API to set Versioning Behavior is brittle because it needs to be called during the first workflow task.

Checklist

  1. Closes
    Enable type-scoped Versioning Behavior for workflows  #1698
  2. How was this tested:

An integration test using gRPC interceptors

Comment on lines 587 to 589
if options.VersioningBehavior != VersioningBehaviorUnspecified {
r.workflowVersioningBehaviorMap[registerName] = options.VersioningBehavior
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if options.VersioningBehavior != VersioningBehaviorUnspecified {
r.workflowVersioningBehaviorMap[registerName] = options.VersioningBehavior
}
r.workflowVersioningBehaviorMap[registerName] = options.VersioningBehavior

Could just put it in the map always and remove the , ok approach from the getter and just rely on unspecified to be equivalent to unset. Not a big deal, but I think it makes for cleaner code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general I don't like adding unnecessary entries to maps, but here there is no performance/space issue and it is cleaner...
Done

@antlai-temporal antlai-temporal merged commit edb4b32 into temporalio:versioning-3 Nov 13, 2024
10 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants