Skip to content

Commit

Permalink
Refactor DriverExecuteBatchExecutor (#31597)
Browse files Browse the repository at this point in the history
  • Loading branch information
terrymanu authored Jun 5, 2024
1 parent 156475b commit feb2de8
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@ public DriverExecuteBatchExecutor(final ShardingSphereConnection connection, fin
*/
public void addBatch(final QueryContext queryContext, final ShardingSphereDatabase database) {
Optional<String> trafficInstanceId = connection.getTrafficInstanceId(metaData.getGlobalRuleMetaData().getSingleRule(TrafficRule.class), queryContext);
ExecutionContext result = trafficInstanceId.map(optional -> createExecutionContext(queryContext, optional)).orElseGet(() -> createExecutionContext(queryContext, database));
batchPreparedStatementExecutor.addBatchForExecutionUnits(result.getExecutionUnits());
executionContext = result;
executionContext = trafficInstanceId.map(optional -> createExecutionContext(queryContext, optional)).orElseGet(() -> createExecutionContext(queryContext, database));
batchPreparedStatementExecutor.addBatchForExecutionUnits(executionContext.getExecutionUnits());
}

private ExecutionContext createExecutionContext(final QueryContext queryContext, final String trafficInstanceId) {
Expand Down

0 comments on commit feb2de8

Please sign in to comment.