Skip to content

Commit

Permalink
improve compile logic
Browse files Browse the repository at this point in the history
  • Loading branch information
flarco committed Oct 16, 2024
1 parent 2f54c40 commit 7bfbaaa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions core/sling/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,17 @@ func (rd *ReplicationConfig) ProcessWildcardsFile(c connection.Connection, patte
// Compile compiles the replication into tasks
func (rd *ReplicationConfig) Compile(cfgOverwrite *Config, selectStreams ...string) (err error) {
if rd.Compiled {
// apply the selection if specified
if len(selectStreams) > 0 {
selectedTasks := []*Config{}
nameMap := g.ArrMapString(selectStreams)
for _, task := range rd.Tasks {
if _, ok := nameMap[task.StreamName]; ok {
selectedTasks = append(selectedTasks, task)
}
}
rd.Tasks = selectedTasks
}
return nil
}

Expand Down

0 comments on commit 7bfbaaa

Please sign in to comment.