Skip to content

Commit

Permalink
Remove search attribute registration before starting every workflow (#94
Browse files Browse the repository at this point in the history
)
  • Loading branch information
bergundy authored Jul 17, 2024
1 parent feb9b4c commit 2f4364b
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions loadgen/scenario.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"time"

"github.com/temporalio/omes/loadgen/kitchensink"
"go.temporal.io/api/enums/v1"
"go.temporal.io/api/operatorservice/v1"
"go.temporal.io/sdk/client"
"go.uber.org/zap"
)
Expand Down Expand Up @@ -199,33 +197,6 @@ func (r *Run) ExecuteKitchenSinkWorkflow(ctx context.Context, options *KitchenSi
return fmt.Errorf("failed to start kitchen sink workflow: %w", err)
}

// Ensure custom search attributes are registered
_, err = r.Client.OperatorService().AddSearchAttributes(ctx, &operatorservice.AddSearchAttributesRequest{
SearchAttributes: map[string]enums.IndexedValueType{
"KS_Keyword": enums.INDEXED_VALUE_TYPE_KEYWORD,
"KS_Int": enums.INDEXED_VALUE_TYPE_INT,
},
Namespace: r.Namespace,
})

// Throw an error if the attributes could not be registered, but ignore already exists errs
alreadyExistsStrings := []string{
"already exists",
"attributes mapping unavailble",
}
if err != nil {
isAlreadyExistsErr := false
for _, s := range alreadyExistsStrings {
if strings.Contains(err.Error(), s) {
isAlreadyExistsErr = true
break
}
}
if !isAlreadyExistsErr {
return fmt.Errorf("failed to register search attributes: %w", err)
}
}

clientSeq := options.Params.ClientSequence
cancelCtx, cancel := context.WithCancel(ctx)
defer cancel()
Expand Down

0 comments on commit 2f4364b

Please sign in to comment.