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

fix(temporal): fix schedule workflow search attributes #185

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"go.temporal.io/api/enums/v1"
"go.temporal.io/sdk/client"
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow"
)

Expand All @@ -20,6 +21,19 @@ type ScheduleCreateOptions struct {
}

func (a Activities) TemporalScheduleCreate(ctx context.Context, options ScheduleCreateOptions) (string, error) {
attributes := make([]temporal.SearchAttributeUpdate, 0, len(options.SearchAttributes))
for key, value := range options.SearchAttributes {
v, ok := value.(string)
if !ok {
continue
}

attributes = append(attributes,
temporal.NewSearchAttributeKeyKeyword(key).ValueSet(v),
)
}
options.Action.TypedSearchAttributes = temporal.NewSearchAttributes(attributes...)

handle, err := a.temporalClient.ScheduleClient().Create(ctx, client.ScheduleOptions{
ID: options.ScheduleID,
Spec: client.ScheduleSpec{
Expand Down
6 changes: 0 additions & 6 deletions internal/connectors/engine/workflow/plugin_workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/pkg/errors"
"go.temporal.io/api/enums/v1"
"go.temporal.io/sdk/client"
"go.temporal.io/sdk/temporal"
"go.temporal.io/sdk/workflow"
)

Expand Down Expand Up @@ -123,11 +122,6 @@ func (w Workflow) run(
task.NextTasks,
},
TaskQueue: connectorID.String(),
// Search attributes are used to query workflows
TypedSearchAttributes: temporal.NewSearchAttributes(
temporal.NewSearchAttributeKeyKeyword(SearchAttributeScheduleID).ValueSet(scheduleID),
temporal.NewSearchAttributeKeyKeyword(SearchAttributeStack).ValueSet(w.stack),
),
},
Overlap: enums.SCHEDULE_OVERLAP_POLICY_SKIP,
TriggerImmediately: true,
Expand Down