diff --git a/update-service/src/main/java/com/xuqm/update/service/StoreSubmissionService.java b/update-service/src/main/java/com/xuqm/update/service/StoreSubmissionService.java index df83897..ccf4405 100644 --- a/update-service/src/main/java/com/xuqm/update/service/StoreSubmissionService.java +++ b/update-service/src/main/java/com/xuqm/update/service/StoreSubmissionService.java @@ -228,7 +228,15 @@ public class StoreSubmissionService { })) .toList(); if (!futures.isEmpty()) { - CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join(); + try { + CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])) + .get(20, java.util.concurrent.TimeUnit.MINUTES); + } catch (java.util.concurrent.TimeoutException te) { + log.error("Store submit batch timed out after 20 minutes for version={}", versionId); + futures.forEach(f -> f.cancel(true)); + } catch (Exception e) { + log.error("Store submit batch wait error for version={}: {}", versionId, e.getMessage()); + } } recordBatchEvent(v, versionId, batchId, "STORE_SUBMIT_BATCH_END", startedAt, Map.of( "targets", targets, @@ -285,8 +293,12 @@ public class StoreSubmissionService { // 3. Request upload URL Map uploadUrlResp = huaweiGetUploadUrl(clientId, token, hwAppId, file); - @SuppressWarnings("unchecked") - Map urlInfo = (Map) ((List) uploadUrlResp.get("urlList")).get(0); + List> urlList = asMapList(uploadUrlResp.get("urlList")); + if (urlList.isEmpty()) urlList = asMapList(uploadUrlResp.get("data")); + if (urlList.isEmpty()) { + throw new RuntimeException("Huawei: upload url response missing urlList, response=" + summarizeMap(uploadUrlResp)); + } + Map urlInfo = urlList.get(0); String uploadUrl = (String) urlInfo.get("url"); @SuppressWarnings("unchecked") Map uploadHeaders = (Map) urlInfo.get("headers");