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

Fix for early auction close with video + done cb cleanup #3024

Merged
merged 5 commits into from
Sep 11, 2018

Conversation

jaiminpanchal27
Copy link
Collaborator

Type of change

  • Refactoring (no functional changes, no api changes)

Description of change

Cleaning up done callback which closes the auction. Simplifying the design.

src/auction.js Outdated
let doneCalled = 0;
return function() {
doneCalled++;
if (doneCalled === bidderCount) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we concerned that some bidders will call multiple done callbacks causing the auction to close early?

}
}

function adapterDone() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do we need adapterDone for?

@mkendall07
Copy link
Member

Honestly was pretty confused reading the code. Let's walk through this a bit.

Copy link
Member

@mkendall07 mkendall07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rename things as discussed + add unit tests for callback functionality.

Thanks!

@mkendall07 mkendall07 changed the title done cb cleanup Fix for early auction close with video + done cb cleanup Sep 7, 2018
Copy link
Collaborator

@jsnellbaker jsnellbaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jaiminpanchal27 I did some testing with multiple video ad units and mix of instream/outstream and it seems like the auction is completing successfully after the bids were cached.

See some additional points to consider below.

src/auction.js Outdated
}

function adapterDone() {
// events.emit(CONSTANTS.EVENTS.BIDDER_DONE, bidderRequest);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can remove commented code (if we truly do not need to emit this event here).

let bidRequest = getBidderRequest(bidRequests, bid.bidderCode, adUnitCode);
let bidResponse = getPreparedBidForAuction({adUnitCode, bid, bidRequest, auctionId});

if (bidResponse.mediaType === 'video') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should add logic (here?) to clarify only for instream video adUnits, since outstream video adUnits shouldn't need to be cached.

src/auction.js Outdated
@@ -316,7 +356,7 @@ function addBidToAuction(auctionInstance, bidResponse) {
}

// Video bids may fail if the cache is down, or there's trouble on the network.
function tryAddVideoBid(auctionInstance, bidResponse, bidRequest) {
function tryAddVideoBid(auctionInstance, bidResponse, bidRequest, afterBidAdded) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could remove bidRequest from arguments here since it doesn't appear to be used now with these new changes.

Copy link
Member

@mkendall07 mkendall07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@mkendall07 mkendall07 merged commit f272031 into master Sep 11, 2018
ptomasroos pushed a commit to happypancake/Prebid.js that referenced this pull request Sep 25, 2018
* done cb cleanup

* rename some vars

* added unit tests, updates after changes requested

* add deprecated notice to function
pedrolopezmrf pushed a commit to Marfeel/Prebid.js that referenced this pull request Mar 18, 2019
* done cb cleanup

* rename some vars

* added unit tests, updates after changes requested

* add deprecated notice to function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants