Skip to content

Commit

Permalink
Fix wrong url when sync product contents
Browse files Browse the repository at this point in the history
  • Loading branch information
nntthuy-axonivy committed Jul 12, 2024
1 parent 4398647 commit c7c969f
Showing 1 changed file with 4 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
import java.io.IOException;
import java.net.URL;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import com.axonivy.market.constants.CommonConstants;
import com.axonivy.market.github.service.GHAxonIvyProductRepoService;
Expand Down Expand Up @@ -264,23 +260,12 @@ private void updateProductFromReleaseTags(Product product) {
product.setCompatibility(compatibility);
}

List<CompletableFuture<ProductModuleContent>> completableFutures = new ArrayList<>();
ExecutorService service = Executors.newFixedThreadPool(10);
List<ProductModuleContent> productModuleContents = new ArrayList<>();
for (GHTag ghtag : tags) {
completableFutures.add(CompletableFuture.supplyAsync(
() -> axonIvyProductRepoService.getReadmeAndProductContentsFromTag(product, productRepo, ghtag.getName()),
service));
ProductModuleContent productModuleContent =
axonIvyProductRepoService.getReadmeAndProductContentsFromTag(product, productRepo, ghtag.getName());
productModuleContents.add(productModuleContent);
}
completableFutures.forEach(CompletableFuture::join);
List<ProductModuleContent> productModuleContents = completableFutures.stream().map(completableFuture -> {
try {
return completableFuture.get();
} catch (InterruptedException | ExecutionException e) {
Thread.currentThread().interrupt();
log.error("Get readme and product json contents failed", e);
return null;
}
}).toList();
product.setProductModuleContents(productModuleContents);
} catch (Exception e) {
log.error("Cannot find repository by path {} {}", product.getRepositoryName(), e);
Expand Down

0 comments on commit c7c969f

Please sign in to comment.