Skip to content

Commit

Permalink
Move NameAndExclude set contruction to constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
serprex committed Nov 11, 2023
1 parent 11f910d commit e6607f7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 1 addition & 8 deletions flow/activities/flowable.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,7 @@ func (a *FlowableActivity) StartFlow(ctx context.Context,

tblNameMapping := make(map[string]model.NameAndExclude)
for _, v := range input.FlowConnectionConfigs.TableMappings {
exclude := make(map[string]struct{}, len(v.Exclude))
for _, col := range v.Exclude {
exclude[col] = struct{}{}
}
tblNameMapping[v.SourceTableIdentifier] = model.NameAndExclude{
Name: v.DestinationTableIdentifier,
Exclude: exclude,
}
tblNameMapping[v.SourceTableIdentifier] = model.NewNameAndExclude(v.DestinationTableIdentifier, v.Exclude)
}

idleTimeout := utils.GetEnvInt("PEERDB_CDC_IDLE_TIMEOUT_SECONDS", 10)
Expand Down
8 changes: 8 additions & 0 deletions flow/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ type NameAndExclude struct {
Exclude map[string]struct{}
}

func NewNameAndExclude(name string, exclude []string) NameAndExclude {
exset := make(map[string]struct{}, len(exclude))
for _, col := range exclude {
exset[col] = struct{}{}
}
return NameAndExclude{Name: name, Exclude: exset}
}

type PullRecordsRequest struct {
// FlowJobName is the name of the flow job.
FlowJobName string
Expand Down

0 comments on commit e6607f7

Please sign in to comment.