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 9b51bb8 commit cb57572
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public static void decorate(final RouteContext routeContext, final ShadowRule ru
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 cb57572

Please sign in to comment.