Skip to content

Commit 3129c4e

Browse files
authored
Merge pull request #101 from trimble-oss/sync_by_region
Sync by region
2 parents 59053e3 + 939adb3 commit 3129c4e

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

flow/process_genericflow.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,25 @@ func tableConfigurationFlowPullRemote(tfmContext FlowMachineContext, tfContext F
130130
return tableConfigMapArr, nil
131131
}
132132

133+
// During refreshingDaily, filter regions to respect data isolation
134+
// Only apply filtering when running in single-region deployments (hive pods: only east or only west)
135+
// Multi-region deployments (standalone plugins with both east and west) should pull from all configured regions
136+
if tfContext.FlowSyncModeMatchAny([]string{"refreshingDaily"}) && len(regionSyncList) == 1 {
137+
validRegions := []string{}
138+
for _, region := range regionSyncList {
139+
// Check if this region has a configured remote data source
140+
// This respects the region configuration of the current instance
141+
if _, ok := tfContext.GetRemoteDataSourceAttribute("region-" + region).(map[string]any); ok {
142+
validRegions = append(validRegions, region)
143+
}
144+
}
145+
if len(validRegions) == 0 {
146+
tfmContext.Log("No configured regions found for daily refresh", nil)
147+
return tableConfigMapArr, nil
148+
}
149+
regionSyncList = validRegions
150+
}
151+
133152
var sqlConn *sql.DB
134153
sort.Strings(regionSyncList) // Puts west at the end
135154
for _, region := range regionSyncList {

0 commit comments

Comments
 (0)