Skip to content

Commit

Permalink
Fix after review
Browse files Browse the repository at this point in the history
  • Loading branch information
DGarbar committed Oct 29, 2020
1 parent 02a2fda commit acd8729
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
12 changes: 5 additions & 7 deletions src/main/java/org/prebid/server/auction/ExchangeService.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,14 @@ public Future<BidResponse> holdAuction(AuctionContext context) {
.compose(impsRequiredRequest -> extractBidderRequests(context, impsRequiredRequest, aliases))
.map(bidderRequests -> updateRequestMetric(
bidderRequests, uidsCookie, aliases, publisherId, context.getRequestTypeMetric()))
.map(bidderRequests -> maybeLogBidderInteraction(context, bidderRequests))
.compose(bidderRequests -> CompositeFuture.join(bidderRequests.stream()
.map(bidderRequest -> requestBids(
bidderRequest,
auctionTimeout(timeout, cacheInfo.isDoCaching()),
debugEnabled,
aliases))
.collect(Collectors.toList()))
.map(compositeFuture -> maybeLogBidderInteraction(context, bidderRequests, compositeFuture)))
.collect(Collectors.toList())))
// send all the requests to the bidders and gathers results
.map(CompositeFuture::<BidderResponse>list)
.map(bidderResponses -> storedResponseProcessor.mergeWithBidderResponses(
Expand Down Expand Up @@ -934,11 +934,9 @@ private Timeout auctionTimeout(Timeout timeout, boolean shouldCacheBids) {
return shouldCacheBids ? timeout.minus(expectedCacheTime) : timeout;
}

private CompositeFuture maybeLogBidderInteraction(AuctionContext context,
List<BidderRequest> bidderResponses,
CompositeFuture compositeFuture) {
bidderResponses.forEach(bidderResponse -> httpInteractionLogger.maybeLogBidderRequest(context, bidderResponse));
return compositeFuture;
private List<BidderRequest> maybeLogBidderInteraction(AuctionContext context, List<BidderRequest> bidderRequests) {
bidderRequests.forEach(bidderRequest -> httpInteractionLogger.maybeLogBidderRequest(context, bidderRequest));
return bidderRequests;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
import org.prebid.server.metric.MetricName;
import org.prebid.server.settings.model.Account;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -171,10 +169,7 @@ private Imp makeImpExtBidderName(String bidder, Imp imp) {

final JsonNode impExtBidder = impExt.remove("bidder");
if (impExtBidder != null) {
final Iterator<Map.Entry<String, JsonNode>> bidderParams = impExtBidder.fields();
final ObjectNode impExtBidderName = impExt.putObject(bidder);
bidderParams
.forEachRemaining(keyToValue -> impExtBidderName.set(keyToValue.getKey(), keyToValue.getValue()));
impExt.set(bidder, impExtBidder);
}
return updatedImp;
}
Expand Down

0 comments on commit acd8729

Please sign in to comment.