|
|
@@ -180,10 +180,13 @@ public class StateEstimationServiceImpl implements StateEstimationService {
|
|
|
//存放失败的线路id
|
|
|
List<String> failFeederIds = Lists.newArrayList();
|
|
|
// 并行调用 (有界线程池), 每批带重试, 任一批最终失败则整体失败
|
|
|
- StateEstimationRequest req = buildStateEstimationReq(request.getPointTime());
|
|
|
for (List<String> batchFeederIds : batches) {
|
|
|
List<CompletableFuture<StateEstimation>> futures = batchFeederIds.stream()
|
|
|
- .map(id -> CompletableFuture.supplyAsync(() -> callWithRetry(id, req), executor))
|
|
|
+ .map(id -> {
|
|
|
+ StateEstimationRequest req = buildStateEstimationReq(request.getPointTime());
|
|
|
+ req.setPsrIds(Collections.singletonList(id));
|
|
|
+ return CompletableFuture.supplyAsync(() -> callWithRetry(id,req), executor);
|
|
|
+ })
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
for (int i = 0; i < futures.size(); i++) {
|
|
|
@@ -355,7 +358,6 @@ public class StateEstimationServiceImpl implements StateEstimationService {
|
|
|
Exception last = null;
|
|
|
for (int attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
|
try {
|
|
|
- req.setPsrIds(Collections.singletonList(single));
|
|
|
StateEstimation resp = this.queryByFeeder(req);
|
|
|
if (resp != null) {
|
|
|
return resp;
|