Skip to content

Commit

Permalink
feat: Update the target host when retrying (#356)
Browse files Browse the repository at this point in the history
* feat: Update the target host when retrying
  • Loading branch information
pangdayuan1 authored Oct 25, 2024
1 parent e7411fa commit b597e35
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
4 changes: 2 additions & 2 deletions arex-schedule-web-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
<parent>
<artifactId>arex-schedule-parent</artifactId>
<groupId>com.arextest</groupId>
<version>2.0.2</version>
<version>2.0.3</version>
</parent>

<profiles>
Expand Down Expand Up @@ -337,5 +337,5 @@
</properties>
</profile>
</profiles>
<version>2.0.2</version>
<version>2.0.3</version>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,5 @@ public void enqueueBizLog(BizLog log) {
public void buildActionItemMap() {
this.getReplayActionItemList().forEach(
replayActionItem -> this.actionItemMap.put(replayActionItem.getId(), replayActionItem));
LOGGER.info("buildActionItemMap, planId:{}, keySet:{}", getId(), actionItemMap.keySet());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ public void updateFailedActionAndCase(ReplayPlan replayPlan,
replayPlan.setReplayActionItemList(failedActionList);

doResumeOperationDescriptor(replayPlan);

setHost(replayPlan);
// filter actionItem by appId and fill exclusionOperationConfig
List<String> excludedActionIds = replayActionItemPreprocessService.filterActionItem(
replayPlan.getReplayActionItemList(), replayPlan.getAppId());
Expand Down Expand Up @@ -387,6 +387,24 @@ public void updateFailedActionAndCase(ReplayPlan replayPlan,
removeErrorMsgTask, updateReportTask, deletePlanItemStatisticsTask, deleteRunDetailsTask).join();
}

private void setHost(ReplayPlan replayPlan) {
if (replayPlan == null || CollectionUtils.isEmpty(replayPlan.getReplayActionItemList()) ||
replayPlan.getReplayActionItemList().get(0) == null || CollectionUtils.isEmpty(
replayPlan.getReplayActionItemList().get(0).getTargetInstance())) {
return;
}

List<ServiceInstance> targetInstance = replayPlan.getReplayActionItemList().get(0).getTargetInstance();
String targetHost = targetInstance.stream().map(ServiceInstance::getIp).distinct().collect(Collectors.joining(","));
replayPlan.setTargetHost(targetHost);
List<ServiceInstance> serviceInstances = replayPlan.getReplayActionItemList().get(0).getSourceInstance();
if (CollectionUtils.isNotEmpty(serviceInstances)) {
String sourceHost = serviceInstances.stream().map(ServiceInstance::getIp).distinct()
.collect(Collectors.joining(","));
replayPlan.setSourceHost(sourceHost);
}
}

public void doResumeOperationDescriptor(ReplayPlan replayPlan) {
PlanContext planContext = planContextCreator.createByAppId(replayPlan.getAppId());
AppServiceOperationDescriptor operationDescriptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ public void updateReportInfo(ReplayPlan replayPlan) {
UpdateReportInfoRequestType requestType = new UpdateReportInfoRequestType();
requestType.setPlanId(replayPlan.getId());
requestType.setTotalCaseCount(replayPlan.getCaseTotalCount());
requestType.setTargetHost(replayPlan.getTargetHost());
requestType.setSourceHost(replayPlan.getSourceHost());
List<ReplayActionItem> actionItemList = replayPlan.getReplayActionItemList();
if (CollectionUtils.isNotEmpty(actionItemList)) {
List<UpdateReportInfoRequestType.UpdateReportItem> updateReportInfoList = new ArrayList<>(actionItemList.size());
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
**/mapping/**
</sonar.exclusions>
<arex-storage-config.version>1.3.4</arex-storage-config.version>
<web-contract.version>0.6.5.2</web-contract.version>
<web-contract.version>0.6.5.7</web-contract.version>
<arex-common.version>1.0.1</arex-common.version>
</properties>

Expand All @@ -317,5 +317,5 @@
<url>https://github.com/arextest/arex-replay-schedule</url>
</scm>
<url>https://github.com/arextest/arex-replay-schedule</url>
<version>2.0.2</version>
<version>2.0.3</version>
</project>

0 comments on commit b597e35

Please sign in to comment.