Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes: Immediate adapter response may end auction #1690

Merged
merged 2 commits into from
Oct 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/adaptermanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ exports.callBids = ({adUnits, cbTimeout}) => {
}
}

let _bidderRequests = [];
// client side adapters
let adUnitsClientCopy = utils.cloneJson(adUnits);
// filter out s2s bids
Expand All @@ -189,20 +190,29 @@ exports.callBids = ({adUnits, cbTimeout}) => {
requestId,
bidderRequestId,
bids: getBids({bidderCode, requestId, bidderRequestId, 'adUnits': adUnitsClientCopy}),
start: new Date().getTime(),
auctionStart: auctionStart,
timeout: cbTimeout
};
if (bidderRequest.bids && bidderRequest.bids.length !== 0) {
utils.logMessage(`CALLING BIDDER ======= ${bidderCode}`);
$$PREBID_GLOBAL$$._bidsRequested.push(bidderRequest);
events.emit(CONSTANTS.EVENTS.BID_REQUESTED, bidderRequest);
adapter.callBids(bidderRequest);
_bidderRequests.push(bidderRequest);
}
} else {
utils.logError(`Adapter trying to be called which does not exist: ${bidderCode} adaptermanager.callBids`);
}
});

_bidderRequests.forEach(bidRequest => {
bidRequest.start = new Date().getTime();
const adapter = _bidderRegistry[bidRequest.bidderCode];
if (adapter) {
if (bidRequest.bids && bidRequest.bids.length !== 0) {
utils.logMessage(`CALLING BIDDER ======= ${bidRequest.bidderCode}`);
events.emit(CONSTANTS.EVENTS.BID_REQUESTED, bidRequest);
adapter.callBids(bidRequest);
}
} else {
utils.logError(`Adapter trying to be called which does not exist: ${bidRequest.bidderCode} adaptermanager.callBids`);
}
})
};

function transformHeightWidth(adUnit) {
Expand Down