Skip to content

Commit

Permalink
[MODORDERS-1209]. Add more logs
Browse files Browse the repository at this point in the history
  • Loading branch information
BKadirkhodjaev committed Dec 4, 2024
1 parent d41dd59 commit 836a422
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public Future<ClaimingResults> sendClaims(ClaimingCollection claimingCollection,
return createJobsByVendor(config, pieceIdsByVendorIds, requestContext);
});
})
.onFailure(t -> logger.error("sendClaims :: Failed send claims: {}", JsonObject.mapFrom(claimingCollection).encodePrettily(), t));
.onFailure(t -> logger.error("sendClaims:: Failed send claims: {}", JsonObject.mapFrom(claimingCollection).encodePrettily(), t));
}

private Future<Map<String, List<String>>> groupPieceIdsByVendorId(List<String> pieceIds, RequestContext requestContext) {
Expand Down
18 changes: 13 additions & 5 deletions src/main/java/org/folio/service/pieces/PieceStorageService.java
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,19 @@ public Future<List<Piece>> getPiecesByIds(List<String> pieceIds, RequestContext
.map(query -> getAllPieces(query, requestContext))
.toList();
return collectResultsOnSuccess(futures)
.map(lists -> lists.stream()
.map(PieceCollection::getPieces)
.flatMap(Collection::stream)
.toList())
.onSuccess(v -> log.info("getPiecesByIds:: pieces by ids successfully retrieve: {}", pieceIds));
.map(lists -> {
try {
return lists.stream()
.map(PieceCollection::getPieces)
.flatMap(Collection::stream)
.toList();
} catch (Throwable t) {
log.error("Failed to unwrap piece chunks");
throw t;
}
})
.onSuccess(v -> log.info("getPiecesByIds:: pieces by ids successfully retrieve: {}", pieceIds))
.onFailure(t -> log.error("Failed to get pieces by ids"));
}

public Future<List<Piece>> getPiecesByLineIdsByChunks(List<String> lineIds, RequestContext requestContext) {
Expand Down

0 comments on commit 836a422

Please sign in to comment.