-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Core: Adding bidLimit to adUnit #13930
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
Conversation
Pull Request Test Coverage Report for Build 18194719118Details
💛 - Coveralls |
src/targeting.ts
Outdated
| // if adUnitBidLimit is set, pass top N number bids | ||
| if (adUnitBidLimit) { | ||
| const adUnit = auctionManager.getAdUnits().find(au => au.code === bucketKey); | ||
| const bidLimit = adUnit?.bidLimit || adUnitBidLimit; |
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.
there's some logic one level up that says roughly "use the bid limit only if sendAllBids is enabled". With this change that's short circuited when the ad unit bid limit is set, which I don't think we want.
Since there you also know all ad units involved it makes sense IMO to calculate the bid limit per adunit there, which lets you loop through them one time instead of once per ad unit. For example the adUnitBidLimit parameter passed into here could be made into a map.
src/targeting.ts
Outdated
| if (!config.getConfig('enableSendAllBids')) return 0; | ||
| const bidLimitConfigValue = config.getConfig('sendBidsControl.bidLimit'); | ||
| return adUnitCodes.reduce((acc, code) => { | ||
| const adUnit = auctionManager.getAdUnits().find(au => au.code === code); |
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.
this is still O(N^2), which is unnecessary. one single loop over getAdUnits() is enough to find those you're interested in.
1053eeb to
476bcbd
Compare
Type of change
Bugfix
Feature
New bidder adapter
Updated bidder adapter
Code style update (formatting, local variables)
Refactoring (no functional changes, no api changes)
Build related changes
CI related changes
Does this change affect user-facing APIs or examples documented on http://prebid.org?
Other
Description of change
Other information
#9842