mirror of
https://github.com/hanzoai/tasks.git
synced 2026-10-04 02:04:03 +00:00
Rename the enabled flags
This commit is contained in:
@@ -13,7 +13,7 @@ import (
|
||||
"go.temporal.io/server/common/rpc/interceptor"
|
||||
)
|
||||
|
||||
var ChasmNexusEnabled = dynamicconfig.NewNamespaceBoolSetting(
|
||||
var EnableChasmNexus = dynamicconfig.NewNamespaceBoolSetting(
|
||||
"nexusoperation.enableChasm",
|
||||
false,
|
||||
`Feature flag that controls whether the legacy HSM-based implementation (when flag is false; default) or the newer
|
||||
@@ -188,8 +188,8 @@ Added for safety. Defaults to true. Likely to be removed in future server versio
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
ChasmEnabled dynamicconfig.BoolPropertyFnWithNamespaceFilter
|
||||
ChasmNexusEnabled dynamicconfig.BoolPropertyFnWithNamespaceFilter
|
||||
EnableChasm dynamicconfig.BoolPropertyFnWithNamespaceFilter
|
||||
EnableChasmNexus dynamicconfig.BoolPropertyFnWithNamespaceFilter
|
||||
NumHistoryShards int32
|
||||
RequestTimeout dynamicconfig.DurationPropertyFnWithDestinationFilter
|
||||
MinRequestTimeout dynamicconfig.DurationPropertyFnWithNamespaceFilter
|
||||
@@ -210,8 +210,8 @@ type Config struct {
|
||||
|
||||
func configProvider(dc *dynamicconfig.Collection, cfg *config.Persistence) *Config {
|
||||
return &Config{
|
||||
ChasmEnabled: dynamicconfig.EnableChasm.Get(dc),
|
||||
ChasmNexusEnabled: ChasmNexusEnabled.Get(dc),
|
||||
EnableChasm: dynamicconfig.EnableChasm.Get(dc),
|
||||
EnableChasmNexus: EnableChasmNexus.Get(dc),
|
||||
NumHistoryShards: cfg.NumHistoryShards,
|
||||
RequestTimeout: RequestTimeout.Get(dc),
|
||||
MinRequestTimeout: MinRequestTimeout.Get(dc),
|
||||
|
||||
@@ -36,7 +36,7 @@ func (ch *commandHandler) handleScheduleCommand(
|
||||
ns := ctx.NamespaceEntry()
|
||||
nsName := ns.Name().String()
|
||||
|
||||
if !ch.config.ChasmNexusEnabled(nsName) {
|
||||
if !ch.config.EnableChasmNexus(nsName) {
|
||||
return chasmworkflow.ErrCommandNotSupported
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ func (ch *commandHandler) handleCancelCommand(
|
||||
opts chasmworkflow.CommandHandlerOptions,
|
||||
) error {
|
||||
nsName := ctx.NamespaceEntry().Name().String()
|
||||
if !ch.config.ChasmNexusEnabled(nsName) {
|
||||
if !ch.config.EnableChasmNexus(nsName) {
|
||||
return chasmworkflow.ErrCommandNotSupported
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ func (tcx *testContext) setHasAnyBufferedEvent(value bool) {
|
||||
}
|
||||
|
||||
var defaultConfig = &nexusoperation.Config{
|
||||
ChasmNexusEnabled: dynamicconfig.GetBoolPropertyFnFilteredByNamespace(true),
|
||||
EnableChasmNexus: dynamicconfig.GetBoolPropertyFnFilteredByNamespace(true),
|
||||
MaxServiceNameLength: dynamicconfig.GetIntPropertyFnFilteredByNamespace(len("service")),
|
||||
MaxOperationNameLength: dynamicconfig.GetIntPropertyFnFilteredByNamespace(len("op")),
|
||||
MaxConcurrentOperationsPerWorkflow: dynamicconfig.GetIntPropertyFnFilteredByNamespace(2),
|
||||
@@ -136,7 +136,7 @@ func newTestContext(t *testing.T, cfg *nexusoperation.Config) testContext {
|
||||
func TestHandleScheduleCommand(t *testing.T) {
|
||||
t.Run("chasm nexus not enabled", func(t *testing.T) {
|
||||
tcx := newTestContext(t, &nexusoperation.Config{
|
||||
ChasmNexusEnabled: dynamicconfig.GetBoolPropertyFnFilteredByNamespace(false),
|
||||
EnableChasmNexus: dynamicconfig.GetBoolPropertyFnFilteredByNamespace(false),
|
||||
})
|
||||
err := tcx.scheduleHandler(tcx.chasmCtx, tcx.wf, commandValidator{maxPayloadSize: 1}, &commandpb.Command{}, chasmworkflow.CommandHandlerOptions{WorkflowTaskCompletedEventID: 1})
|
||||
require.ErrorIs(t, err, chasmworkflow.ErrCommandNotSupported)
|
||||
@@ -634,7 +634,7 @@ func TestHandleScheduleCommand(t *testing.T) {
|
||||
func TestHandleCancelCommand(t *testing.T) {
|
||||
t.Run("chasm nexus not enabled", func(t *testing.T) {
|
||||
tcx := newTestContext(t, &nexusoperation.Config{
|
||||
ChasmNexusEnabled: dynamicconfig.GetBoolPropertyFnFilteredByNamespace(false),
|
||||
EnableChasmNexus: dynamicconfig.GetBoolPropertyFnFilteredByNamespace(false),
|
||||
})
|
||||
err := tcx.cancelHandler(tcx.chasmCtx, tcx.wf, commandValidator{maxPayloadSize: 1}, &commandpb.Command{}, chasmworkflow.CommandHandlerOptions{WorkflowTaskCompletedEventID: 1})
|
||||
require.ErrorIs(t, err, chasmworkflow.ErrCommandNotSupported)
|
||||
|
||||
Reference in New Issue
Block a user