From 621b9154ff22217805bea95b02ea02f0e04a9549 Mon Sep 17 00:00:00 2001 From: Nish Krishnan Date: Thu, 2 May 2024 14:48:53 -0700 Subject: [PATCH] Add WaitForCancellation = true by default. --- .../helloworld/v1/example_temporal.pb.go | 2 +- .../example_xns_temporal.pb.go | 8 +- gen/example/mutex/v1/mutex_temporal.pb.go | 2 +- .../v1/mutexv1xns/mutex_xns_temporal.pb.go | 20 ++++- .../v1/searchattributes_temporal.pb.go | 2 +- .../searchattributes_xns_temporal.pb.go | 5 +- .../v1/updatabletimer_temporal.pb.go | 2 +- .../updatabletimer_xns_temporal.pb.go | 11 ++- gen/example/v1/example_temporal.pb.go | 2 +- .../examplev1xns/example_xns_temporal.pb.go | 17 +++- gen/example/xns/v1/xns_temporal.pb.go | 2 +- .../xns/v1/xnsv1xns/xns_xns_temporal.pb.go | 20 ++++- gen/test/option/v1/option_temporal.pb.go | 2 +- .../v1/optionv1xns/option_xns_temporal.pb.go | 8 +- gen/test/simple/v1/simple_temporal.pb.go | 2 +- .../simple/v1/v1xns/simple_xns_temporal.pb.go | 80 ++++++++++++++++++- gen/test/xnserr/v1/xnserr_temporal.pb.go | 2 +- .../v1/xnserrv1xns/xnserr_xns_temporal.pb.go | 8 +- internal/plugin/xns.go | 6 +- test/xnserr/client.go | 3 +- 20 files changed, 183 insertions(+), 21 deletions(-) diff --git a/gen/example/helloworld/v1/example_temporal.pb.go b/gen/example/helloworld/v1/example_temporal.pb.go index da1f4fcb..726224bd 100644 --- a/gen/example/helloworld/v1/example_temporal.pb.go +++ b/gen/example/helloworld/v1/example_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // diff --git a/gen/example/helloworld/v1/helloworldv1xns/example_xns_temporal.pb.go b/gen/example/helloworld/v1/helloworldv1xns/example_xns_temporal.pb.go index b348b8eb..f301e429 100644 --- a/gen/example/helloworld/v1/helloworldv1xns/example_xns_temporal.pb.go +++ b/gen/example/helloworld/v1/helloworldv1xns/example_xns_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // @@ -237,6 +237,9 @@ func HelloAsync(ctx workflow.Context, req *v1.HelloRequest, opts ...*HelloWorkfl if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -395,6 +398,9 @@ func GoodbyeAsync(ctx workflow.Context, workflowID string, runID string, req *v1 if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } diff --git a/gen/example/mutex/v1/mutex_temporal.pb.go b/gen/example/mutex/v1/mutex_temporal.pb.go index 8fa948ba..ecb9c8a2 100644 --- a/gen/example/mutex/v1/mutex_temporal.pb.go +++ b/gen/example/mutex/v1/mutex_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // diff --git a/gen/example/mutex/v1/mutexv1xns/mutex_xns_temporal.pb.go b/gen/example/mutex/v1/mutexv1xns/mutex_xns_temporal.pb.go index f3e186e4..5b0a3767 100644 --- a/gen/example/mutex/v1/mutexv1xns/mutex_xns_temporal.pb.go +++ b/gen/example/mutex/v1/mutexv1xns/mutex_xns_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // @@ -264,6 +264,9 @@ func MutexAsync(ctx workflow.Context, req *v1.MutexInput, opts ...*MutexWorkflow if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -363,6 +366,9 @@ func MutexWithAcquireLockAsync(ctx workflow.Context, req *v1.MutexInput, signal if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -574,6 +580,9 @@ func SampleWorkflowWithMutexAsync(ctx workflow.Context, req *v1.SampleWorkflowWi if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -732,6 +741,9 @@ func AcquireLockAsync(ctx workflow.Context, workflowID string, runID string, req if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -850,6 +862,9 @@ func LockAcquiredAsync(ctx workflow.Context, workflowID string, runID string, re if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -968,6 +983,9 @@ func ReleaseLockAsync(ctx workflow.Context, workflowID string, runID string, req if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } diff --git a/gen/example/searchattributes/v1/searchattributes_temporal.pb.go b/gen/example/searchattributes/v1/searchattributes_temporal.pb.go index cd55a85e..6a444246 100644 --- a/gen/example/searchattributes/v1/searchattributes_temporal.pb.go +++ b/gen/example/searchattributes/v1/searchattributes_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // diff --git a/gen/example/searchattributes/v1/searchattributesv1xns/searchattributes_xns_temporal.pb.go b/gen/example/searchattributes/v1/searchattributesv1xns/searchattributes_xns_temporal.pb.go index c59a28d7..20a3e600 100644 --- a/gen/example/searchattributes/v1/searchattributesv1xns/searchattributes_xns_temporal.pb.go +++ b/gen/example/searchattributes/v1/searchattributesv1xns/searchattributes_xns_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // @@ -217,6 +217,9 @@ func SearchAttributesAsync(ctx workflow.Context, req *v1.SearchAttributesInput, if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } diff --git a/gen/example/updatabletimer/v1/updatabletimer_temporal.pb.go b/gen/example/updatabletimer/v1/updatabletimer_temporal.pb.go index 05e3d2b3..cf2791fc 100644 --- a/gen/example/updatabletimer/v1/updatabletimer_temporal.pb.go +++ b/gen/example/updatabletimer/v1/updatabletimer_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // diff --git a/gen/example/updatabletimer/v1/updatabletimerv1xns/updatabletimer_xns_temporal.pb.go b/gen/example/updatabletimer/v1/updatabletimerv1xns/updatabletimer_xns_temporal.pb.go index 69267b7f..c5bcebe5 100644 --- a/gen/example/updatabletimer/v1/updatabletimerv1xns/updatabletimer_xns_temporal.pb.go +++ b/gen/example/updatabletimer/v1/updatabletimerv1xns/updatabletimer_xns_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // @@ -255,6 +255,9 @@ func UpdatableTimerAsync(ctx workflow.Context, req *v1.UpdatableTimerInput, opts if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -419,6 +422,9 @@ func GetWakeUpTimeAsync(ctx workflow.Context, workflowID string, runID string, o if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -530,6 +536,9 @@ func UpdateWakeUpTimeAsync(ctx workflow.Context, workflowID string, runID string if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } diff --git a/gen/example/v1/example_temporal.pb.go b/gen/example/v1/example_temporal.pb.go index 6410c942..7c883cff 100644 --- a/gen/example/v1/example_temporal.pb.go +++ b/gen/example/v1/example_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // diff --git a/gen/example/v1/examplev1xns/example_xns_temporal.pb.go b/gen/example/v1/examplev1xns/example_xns_temporal.pb.go index 972d4f68..ff1fc671 100644 --- a/gen/example/v1/examplev1xns/example_xns_temporal.pb.go +++ b/gen/example/v1/examplev1xns/example_xns_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // @@ -280,6 +280,9 @@ func CreateFooAsync(ctx workflow.Context, req *v1.CreateFooRequest, opts ...*Cre if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 3600000000000 // 1 hour } @@ -379,6 +382,9 @@ func CreateFooWithSetFooProgressAsync(ctx workflow.Context, req *v1.CreateFooReq if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 3600000000000 // 1 hour } @@ -550,6 +556,9 @@ func GetFooProgressAsync(ctx workflow.Context, workflowID string, runID string, if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -661,6 +670,9 @@ func SetFooProgressAsync(ctx workflow.Context, workflowID string, runID string, if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -801,6 +813,9 @@ func UpdateFooProgressAsync(ctx workflow.Context, workflowID string, runID strin if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 300000000000 // 5 minutes } diff --git a/gen/example/xns/v1/xns_temporal.pb.go b/gen/example/xns/v1/xns_temporal.pb.go index 187a9a62..167df948 100644 --- a/gen/example/xns/v1/xns_temporal.pb.go +++ b/gen/example/xns/v1/xns_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // diff --git a/gen/example/xns/v1/xnsv1xns/xns_xns_temporal.pb.go b/gen/example/xns/v1/xnsv1xns/xns_xns_temporal.pb.go index 93224547..371b37b1 100644 --- a/gen/example/xns/v1/xnsv1xns/xns_xns_temporal.pb.go +++ b/gen/example/xns/v1/xnsv1xns/xns_xns_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // @@ -220,6 +220,9 @@ func ProvisionFooAsync(ctx workflow.Context, req *v1.ProvisionFooRequest, opts . if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -625,6 +628,9 @@ func CreateFooAsync(ctx workflow.Context, req *v1.CreateFooRequest, opts ...*Cre if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = 20000000000 // 20 seconds } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 { ao.StartToCloseTimeout = 3630000000000 // 1 hour 30 seconds } @@ -724,6 +730,9 @@ func CreateFooWithSetFooProgressAsync(ctx workflow.Context, req *v1.CreateFooReq if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = 20000000000 // 20 seconds } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 { ao.StartToCloseTimeout = 3630000000000 // 1 hour 30 seconds } @@ -895,6 +904,9 @@ func GetFooProgressAsync(ctx workflow.Context, workflowID string, runID string, if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = 20000000000 // 20 seconds } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 { ao.StartToCloseTimeout = 60000000000 // 1 minute } @@ -1006,6 +1018,9 @@ func SetFooProgressAsync(ctx workflow.Context, workflowID string, runID string, if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = 20000000000 // 20 seconds } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 { ao.StartToCloseTimeout = 60000000000 // 1 minute } @@ -1146,6 +1161,9 @@ func UpdateFooProgressAsync(ctx workflow.Context, workflowID string, runID strin if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = 20000000000 // 20 seconds } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 { ao.StartToCloseTimeout = 60000000000 // 1 minute } diff --git a/gen/test/option/v1/option_temporal.pb.go b/gen/test/option/v1/option_temporal.pb.go index 1054ccfb..17aa6c7f 100644 --- a/gen/test/option/v1/option_temporal.pb.go +++ b/gen/test/option/v1/option_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // diff --git a/gen/test/option/v1/optionv1xns/option_xns_temporal.pb.go b/gen/test/option/v1/optionv1xns/option_xns_temporal.pb.go index f561e1c6..18d15ca1 100644 --- a/gen/test/option/v1/optionv1xns/option_xns_temporal.pb.go +++ b/gen/test/option/v1/optionv1xns/option_xns_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // @@ -238,6 +238,9 @@ func WorkflowWithInputAsync(ctx workflow.Context, req *v1.WorkflowWithInputReque if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 600000000000 // 10 minutes } @@ -417,6 +420,9 @@ func UpdateWithInputAsync(ctx workflow.Context, workflowID string, runID string, if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 300000000000 // 5 minutes } diff --git a/gen/test/simple/v1/simple_temporal.pb.go b/gen/test/simple/v1/simple_temporal.pb.go index b70dafbc..df8bb559 100644 --- a/gen/test/simple/v1/simple_temporal.pb.go +++ b/gen/test/simple/v1/simple_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // diff --git a/gen/test/simple/v1/v1xns/simple_xns_temporal.pb.go b/gen/test/simple/v1/v1xns/simple_xns_temporal.pb.go index 764c1c11..a264cdf5 100644 --- a/gen/test/simple/v1/v1xns/simple_xns_temporal.pb.go +++ b/gen/test/simple/v1/v1xns/simple_xns_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // @@ -314,6 +314,9 @@ func SomeWorkflow1Async(ctx workflow.Context, req *v1.SomeWorkflow1Request, opts if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -534,6 +537,9 @@ func SomeWorkflow2Async(ctx workflow.Context, opts ...*SomeWorkflow2WorkflowOpti if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -626,6 +632,9 @@ func SomeWorkflow2WithSomeSignal1Async(ctx workflow.Context, opts ...*SomeWorkfl if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -827,6 +836,9 @@ func SomeWorkflow3Async(ctx workflow.Context, req *v1.SomeWorkflow3Request, opts if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 3600000000000 // 1 hour } @@ -932,6 +944,9 @@ func SomeWorkflow3WithSomeSignal2Async(ctx workflow.Context, req *v1.SomeWorkflo if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 3600000000000 // 1 hour } @@ -1103,6 +1118,9 @@ func SomeQuery1Async(ctx workflow.Context, workflowID string, runID string, opts if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -1220,6 +1238,9 @@ func SomeQuery2Async(ctx workflow.Context, workflowID string, runID string, req if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -1338,6 +1359,9 @@ func SomeSignal1Async(ctx workflow.Context, workflowID string, runID string, opt if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -1449,6 +1473,9 @@ func SomeSignal2Async(ctx workflow.Context, workflowID string, runID string, req if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -1567,6 +1594,9 @@ func SomeSignal3Async(ctx workflow.Context, workflowID string, runID string, req if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -1707,6 +1737,9 @@ func SomeUpdate1Async(ctx workflow.Context, workflowID string, runID string, req if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 300000000000 // 5 minutes } @@ -2513,6 +2546,9 @@ func OtherWorkflowAsync(ctx workflow.Context, req *v1.OtherWorkflowRequest, opts if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -2677,6 +2713,9 @@ func OtherQueryAsync(ctx workflow.Context, workflowID string, runID string, opts if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -2788,6 +2827,9 @@ func OtherSignalAsync(ctx workflow.Context, workflowID string, runID string, req if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -2928,6 +2970,9 @@ func OtherUpdateAsync(ctx workflow.Context, workflowID string, runID string, req if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 300000000000 // 5 minutes } @@ -3407,6 +3452,9 @@ func WhatAsync(ctx workflow.Context, req *v1.WhatRequest, opts ...*WhatWorkflowO if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -3952,6 +4000,9 @@ func SomeDeprecatedWorkflow1Async(ctx workflow.Context, req *v1.SomeDeprecatedMe if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -4046,6 +4097,9 @@ func SomeDeprecatedWorkflow1WithSomeDeprecatedSignal1Async(ctx workflow.Context, if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -4308,6 +4362,9 @@ func SomeDeprecatedWorkflow2Async(ctx workflow.Context, req *v1.SomeDeprecatedMe if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -4402,6 +4459,9 @@ func SomeDeprecatedWorkflow2WithSomeDeprecatedSignal2Async(ctx workflow.Context, if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -4567,6 +4627,9 @@ func SomeDeprecatedQuery1Async(ctx workflow.Context, workflowID string, runID st if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -4697,6 +4760,9 @@ func SomeDeprecatedQuery2Async(ctx workflow.Context, workflowID string, runID st if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -4821,6 +4887,9 @@ func SomeDeprecatedSignal1Async(ctx workflow.Context, workflowID string, runID s if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -4945,6 +5014,9 @@ func SomeDeprecatedSignal2Async(ctx workflow.Context, workflowID string, runID s if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 60000000000 // 1 minute } @@ -5091,6 +5163,9 @@ func SomeDeprecatedUpdate1Async(ctx workflow.Context, workflowID string, runID s if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 300000000000 // 5 minutes } @@ -5263,6 +5338,9 @@ func SomeDeprecatedUpdate2Async(ctx workflow.Context, workflowID string, runID s if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 300000000000 // 5 minutes } diff --git a/gen/test/xnserr/v1/xnserr_temporal.pb.go b/gen/test/xnserr/v1/xnserr_temporal.pb.go index fd23274a..3e148086 100644 --- a/gen/test/xnserr/v1/xnserr_temporal.pb.go +++ b/gen/test/xnserr/v1/xnserr_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // diff --git a/gen/test/xnserr/v1/xnserrv1xns/xnserr_xns_temporal.pb.go b/gen/test/xnserr/v1/xnserrv1xns/xnserr_xns_temporal.pb.go index 29de45cd..d28614bb 100644 --- a/gen/test/xnserr/v1/xnserrv1xns/xnserr_xns_temporal.pb.go +++ b/gen/test/xnserr/v1/xnserrv1xns/xnserr_xns_temporal.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go_temporal. DO NOT EDIT. // versions: // -// protoc-gen-go_temporal 1.12.1-next (96aa1f87eb6a65319940f8e96aa513502b4c3d4d) +// protoc-gen-go_temporal 1.12.1-next (a78db519c2d773ff50c5df10c022b3c9b271e7be) // go go1.22.1 // protoc (unknown) // @@ -216,6 +216,9 @@ func SleepAsync(ctx workflow.Context, req *v1.SleepRequest, opts ...*SleepWorkfl if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = 30000000000 // 30 seconds } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } @@ -548,6 +551,9 @@ func CallSleepAsync(ctx workflow.Context, req *v1.CallSleepRequest, opts ...*Cal if ao.HeartbeatTimeout == 0 { ao.HeartbeatTimeout = opt.HeartbeatInterval * 2 } + // WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled + ao.WaitForCancellation = true + if ao.StartToCloseTimeout == 0 && ao.ScheduleToCloseTimeout == 0 { ao.ScheduleToCloseTimeout = 86400000000000 // 1 day } diff --git a/internal/plugin/xns.go b/internal/plugin/xns.go index 679794b3..c5e87bd6 100644 --- a/internal/plugin/xns.go +++ b/internal/plugin/xns.go @@ -2911,8 +2911,12 @@ func initializeXNSOptions(fn *g.Group, opts *temporalv1.XNSActivityOptions, defa } else { bl.Id("ao").Dot("HeartbeatTimeout").Op("=").Id("opt").Dot("HeartbeatInterval").Op("*").Lit(2) } - }) + + fn.Comment("WaitForCancellation must be set otherwise the underlying workflow is not guaranteed to be canceled") + fn.Id("ao").Dot("WaitForCancellation").Op("=").Lit(true) + fn.Line() + // set retry policy if defined if v := opts.GetRetryPolicy(); v != nil { fn.If(g.Id("ao").Dot("RetryPolicy").Op("==").Nil()).Block( diff --git a/test/xnserr/client.go b/test/xnserr/client.go index 670777d1..6ac69ad7 100644 --- a/test/xnserr/client.go +++ b/test/xnserr/client.go @@ -28,8 +28,7 @@ func (w *CallSleepWorkflow) Execute(ctx workflow.Context) error { xns.UnmarshalStartWorkflowOptions(w.Req.GetStartWorkflowOptions()), ). WithActivityOptions(workflow.ActivityOptions{ - RetryPolicy: xns.UnmarshalRetryPolicy(w.Req.GetRetryPolicy()), - WaitForCancellation: true, + RetryPolicy: xns.UnmarshalRetryPolicy(w.Req.GetRetryPolicy()), }), ) }