-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Update Workflow/Activity priority #8396
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
Changes from all commits
20e755a
7f733c6
96d9481
ed125d4
a5936ed
0bf3962
d76b42e
00b396f
a494b82
ffc68fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ import ( | |
| "go.temporal.io/api/workflowservice/v1" | ||
| "go.temporal.io/server/api/historyservice/v1" | ||
| persistencespb "go.temporal.io/server/api/persistence/v1" | ||
| "go.temporal.io/server/common" | ||
| "go.temporal.io/server/common/definition" | ||
| "go.temporal.io/server/common/namespace" | ||
| "go.temporal.io/server/common/util" | ||
|
|
@@ -148,6 +149,7 @@ func processActivityOptionsUpdate( | |
| ScheduleToStartTimeout: ai.ScheduleToStartTimeout, | ||
| StartToCloseTimeout: ai.StartToCloseTimeout, | ||
| HeartbeatTimeout: ai.HeartbeatTimeout, | ||
| Priority: common.CloneProto(ai.Priority), | ||
| RetryPolicy: &commonpb.RetryPolicy{ | ||
| BackoffCoefficient: ai.RetryBackoffCoefficient, | ||
| InitialInterval: ai.RetryInitialInterval, | ||
|
|
@@ -202,10 +204,48 @@ func mergeActivityOptions( | |
| mergeInto.HeartbeatTimeout = mergeFrom.HeartbeatTimeout | ||
| } | ||
|
|
||
| if _, ok := updateFields["priority"]; ok { | ||
| mergeInto.Priority = mergeFrom.Priority | ||
| } | ||
|
|
||
| if _, ok := updateFields["priority.priorityKey"]; ok { | ||
| if mergeFrom.Priority == nil { | ||
| return serviceerror.NewInvalidArgument("Priority is not provided") | ||
| } | ||
| if mergeInto.Priority == nil { | ||
| mergeInto.Priority = &commonpb.Priority{} | ||
| } | ||
| mergeInto.Priority.PriorityKey = mergeFrom.Priority.PriorityKey | ||
| } | ||
|
|
||
| if _, ok := updateFields["priority.fairnessKey"]; ok { | ||
| if mergeFrom.Priority == nil { | ||
| return serviceerror.NewInvalidArgument("Priority is not provided") | ||
| } | ||
| if mergeInto.Priority == nil { | ||
| mergeInto.Priority = &commonpb.Priority{} | ||
| } | ||
| mergeInto.Priority.FairnessKey = mergeFrom.Priority.FairnessKey | ||
| } | ||
|
|
||
| if _, ok := updateFields["priority.fairnessWeight"]; ok { | ||
| if mergeFrom.Priority == nil { | ||
| return serviceerror.NewInvalidArgument("Priority is not provided") | ||
| } | ||
| if mergeInto.Priority == nil { | ||
| mergeInto.Priority = &commonpb.Priority{} | ||
| } | ||
| mergeInto.Priority.FairnessWeight = mergeFrom.Priority.FairnessWeight | ||
| } | ||
|
|
||
| if mergeInto.RetryPolicy == nil { | ||
| mergeInto.RetryPolicy = &commonpb.RetryPolicy{} | ||
| } | ||
|
|
||
| if _, ok := updateFields["retryPolicy"]; ok { | ||
| mergeInto.RetryPolicy = mergeFrom.RetryPolicy | ||
| } | ||
|
Comment on lines
+245
to
+247
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like a reasonable addition to me.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess so. I was originally a little confused at the semantics, but it seems reasonable, to allow updating a whole sub-object without listing all the fields |
||
|
|
||
| if _, ok := updateFields["retryPolicy.initialInterval"]; ok { | ||
| if mergeFrom.RetryPolicy == nil { | ||
| return serviceerror.NewInvalidArgument("RetryPolicy is not provided") | ||
|
|
@@ -295,6 +335,7 @@ func updateActivityOptions( | |
| activityInfo.ScheduleToStartTimeout = activityOptions.ScheduleToStartTimeout | ||
| activityInfo.StartToCloseTimeout = activityOptions.StartToCloseTimeout | ||
| activityInfo.HeartbeatTimeout = activityOptions.HeartbeatTimeout | ||
| activityInfo.Priority = activityOptions.Priority | ||
| activityInfo.RetryMaximumInterval = activityOptions.RetryPolicy.MaximumInterval | ||
| activityInfo.RetryBackoffCoefficient = activityOptions.RetryPolicy.BackoffCoefficient | ||
| activityInfo.RetryInitialInterval = activityOptions.RetryPolicy.InitialInterval | ||
|
|
@@ -375,6 +416,7 @@ func restoreOriginalOptions( | |
| ScheduleToStartTimeout: originalOptions.ScheduleToStartTimeout, | ||
| StartToCloseTimeout: originalOptions.StartToCloseTimeout, | ||
| HeartbeatTimeout: originalOptions.HeartbeatTimeout, | ||
| Priority: originalOptions.Priority, | ||
| RetryPolicy: originalOptions.RetryPolicy, | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems much more consistent and a better error type, too.