-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Restore return format of bidsBackHandler callback #371
Conversation
@@ -249,12 +249,37 @@ function processCallbacks(callbackQueue) { | |||
if (utils.isArray(callbackQueue)) { | |||
for (i = 0; i < callbackQueue.length; i++) { | |||
var func = callbackQueue[i]; | |||
func.call(pbjs, pbjs._bidsReceived); | |||
func.call(pbjs, pbjs._bidsReceived.reduce(groupByPlacement, {})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@protonate
Is there a way to reduce _bidsReceived by the requestId
on this
request? With this implementation we get an expanding list of bids back each time a requestBids is fired...
@mkendall07 ready for review & test |
@@ -32,8 +32,10 @@ var eventValidators = { | |||
|
|||
/* Public vars */ | |||
|
|||
pbjs._auctionRunning = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we want to put this in pbjs
? They can reset this flag to force a new request without clearing the other globals... edit: nvm, implementation works.
74f29f2
to
cf98783
Compare
const requestId = utils.getUniqueIdentifierStr(); | ||
adUnitCodes = adUnitCodes || getBidderCodes(); | ||
|
||
getBidderCodes().forEach(bidderCode => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace with adUnitCodes
If an auction is running don't accept a new request for bids.. This adds a `clearAuction` function to set `auctionRunning` false and to clear `_bidsRequested` and `_bidsReceived`. This is a stopgap measure util #353
…s()`, disambiguate `bidmanager.getBidderCode`
eacbb65
to
5653026
Compare
LGTM. Thanks @protonate |
auctionRunning = true; | ||
pbjs._bidsRequested = []; | ||
pbjs._bidsReceived = []; | ||
resetPresetTargeting(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@protonate
I think it makes sense to move this into the setTargetingForGPTAsync
function, because this is GPT specific code. Thoughts?
* a `groupByPlacement` reduce function transforms the bids received array to a map * prevent concurrent bid requests If an auction is running don't accept a new request for bids.. This adds a `clearAuction` function to set `auctionRunning` false and to clear `_bidsRequested` and `_bidsReceived`. This is a stopgap measure util #353 * clear data structures on additional bid request * make auctionRunning private and allow passing adUnits to requestBids * pass adUnitCodes on refresh bids * use adUnitCodes if passed in to requestBids, otherwise `getBidderCodes()`, disambiguate `bidmanager.getBidderCode` * restore use of adUnitCodes to filter adUnits * cherrypick reset targeting merged * clear targeting fixes and test mock * Add GptPubadsDefined check
A
groupByPlacement
reduce function transforms the bids received array to a map which is passed to thebidsBackHandler
callback. This restores behavior to pre-v0.9.1.