Skip to content

Commit

Permalink
Add ShadowDataSourceMappingsFinder
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu committed Nov 3, 2024
1 parent 6a10bc8 commit 9b51bb8
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public void route(RouteContext routeContext, ShadowRule rule, ShadowDataSourceMa
for (RouteUnit each : routeContext.getRouteUnits()) {
String logicName = each.getDataSourceMapper().getLogicName();
String actualName = each.getDataSourceMapper().getActualName();
Optional<String> sourceDataSourceName = rule.findProductionDataSourceName(actualName);
if (sourceDataSourceName.isPresent()) {
String shadowDataSourceName = shadowDataSourceMappings.get(sourceDataSourceName.get());
Optional<String> productionDataSourceName = rule.findProductionDataSourceName(actualName);
if (productionDataSourceName.isPresent()) {
String shadowDataSourceName = shadowDataSourceMappings.get(productionDataSourceName.get());
toBeRemovedRouteUnit.add(each);
toBeAddedRouteUnit.add(null == shadowDataSourceName
? new RouteUnit(new RouteMapper(logicName, sourceDataSourceName.get()), each.getTableMappers())
? new RouteUnit(new RouteMapper(logicName, productionDataSourceName.get()), each.getTableMappers())
: new RouteUnit(new RouteMapper(logicName, shadowDataSourceName), each.getTableMappers()));
}
}
Expand Down

0 comments on commit 9b51bb8

Please sign in to comment.