-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Adding onTimeout function in Adapter Spec #2279
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
Adding onTimeout function in Adapter Spec #2279
Conversation
…ntseta/Prebid.js into feature/bidder-timeout-spec
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.
@vedantseta Thanks a lot for the PR. We're going to need docs for the changes and an additional review since this changes core modules, but one change initially requested:
src/adaptermanager.js
Outdated
}); | ||
timedOutBidders = utils.groupBy(timedOutBidders, 'bidder'); | ||
|
||
for (const bidder of Object.keys(timedOutBidders)) { |
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.
The way for...of
loops transpile have caused us errors for the browsers we support, can you change this to a forEach
or different looping construct?
@matthewlane , Have changed |
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 a conflict that needs resolving but otherwise looks good to me
* @param {object} adunits | ||
* @param {string} adunit code | ||
* @param {string} bidder code | ||
* @return {Array} user configured param for the given bidder adunit configuration |
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.
it's really hard to visualize what this object looks like. Can you add it to the jsdocs typedef here?
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.
return type is Array of Objects,
const adUnits = [{
code: 'adUnit1',
bids: [{
bidder: 'bidder1',
params: {
key1: 'value1'
}
}]
}];
In this case object is adUnits[0].params, which is defined by user
const spec = adapter.getSpec(); | ||
if (spec && spec.onTimeout && typeof spec.onTimeout === 'function') { | ||
utils.logInfo(`Invoking ${bidder}.onTimeout`); | ||
spec.onTimeout(timedOutBidders[bidder]); |
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.
typedef would be nice here for the passed object.
* timeout bidder spec init * refactored * refactored * test case added for getUserConfiguredParams * added more test cases * timeout added as param * minor changes * replacing for..of with forEach * Update utils_spec.js * trailing spaces removed
Type of change
Description of change
This adds a function
onTimeout
to bidder spec, letting bidders to subscribe to their own timeout.Payload received to this function is same as
bidTimeout
event with timeout value and user configured params for this adunit and bidder combination.However the payload contains timed out bids for subscribed bidder, unlike
bidTimeout
event data.Example
Other information
This resolves #2254
Documentation PR : prebid.github.io/pull/678