Skip to content

Commit

Permalink
Prebid 9: update PBS tmax default (#11609)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgirardi authored May 29, 2024
1 parent 69c6160 commit e3f7477
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 160 deletions.
8 changes: 4 additions & 4 deletions modules/prebidServerBidAdapter/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const S2S_VENDORS = {
p1Consent: 'https://prebid.adnxs.com/pbs/v1/cookie_sync',
noP1Consent: 'https://prebid.adnxs-simple.com/pbs/v1/cookie_sync'
},
timeout: 1000
maxTimeout: 1000
},
'rubicon': {
adapter: 'prebidServer',
Expand All @@ -24,7 +24,7 @@ export const S2S_VENDORS = {
p1Consent: 'https://prebid-server.rubiconproject.com/cookie_sync',
noP1Consent: 'https://prebid-server.rubiconproject.com/cookie_sync',
},
timeout: 500
maxTimeout: 500
},
'openx': {
adapter: 'prebidServer',
Expand All @@ -37,7 +37,7 @@ export const S2S_VENDORS = {
p1Consent: 'https://prebid.openx.net/cookie_sync',
noP1Consent: 'https://prebid.openx.net/cookie_sync'
},
timeout: 1000
maxTimeout: 1000
},
'openwrap': {
adapter: 'prebidServer',
Expand All @@ -46,6 +46,6 @@ export const S2S_VENDORS = {
p1Consent: 'https://ow.pubmatic.com/openrtb2/auction?source=pbjs',
noP1Consent: 'https://ow.pubmatic.com/openrtb2/auction?source=pbjs'
},
timeout: 500
maxTimeout: 500
}
}
5 changes: 3 additions & 2 deletions modules/prebidServerBidAdapter/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ let eidPermissions;
* @property {string} [syncEndpoint] endpoint URL for syncing cookies
* @property {Object} [extPrebid] properties will be merged into request.ext.prebid
* @property {Object} [ortbNative] base value for imp.native.request
* @property {Number} [maxTimeout]
*/

/**
* @type {S2SDefaultConfig}
*/
export const s2sDefaultConfig = {
bidders: Object.freeze([]),
timeout: 1000,
syncTimeout: 1000,
maxBids: 1,
adapter: 'prebidServer',
Expand All @@ -100,7 +100,8 @@ export const s2sDefaultConfig = {
eventtrackers: [
{event: 1, methods: [1, 2]}
],
}
},
maxTimeout: 1500
};

config.setDefaults({
Expand Down
3 changes: 2 additions & 1 deletion modules/prebidServerBidAdapter/ortbConverter.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {isActivityAllowed} from '../../src/activities/rules.js';
import {ACTIVITY_TRANSMIT_TID} from '../../src/activities/activities.js';
import {currencyCompare} from '../../libraries/currencyUtils/currency.js';
import {minimum} from '../../src/utils/reducers.js';
import {s2sDefaultConfig} from './index.js';

const DEFAULT_S2S_TTL = 60;
const DEFAULT_S2S_CURRENCY = 'USD';
Expand Down Expand Up @@ -57,7 +58,7 @@ const PBS_CONVERTER = ortbConverter({
let {s2sBidRequest, requestedBidders, eidPermissions} = context;
const request = buildRequest(imps, proxyBidderRequest, context);

request.tmax = s2sBidRequest.s2sConfig.timeout;
request.tmax = s2sBidRequest.s2sConfig.timeout ?? Math.min(s2sBidRequest.requestBidsTimeout * 0.75, s2sBidRequest.s2sConfig.maxTimeout ?? s2sDefaultConfig.maxTimeout);

[request.app, request.dooh, request.site].forEach(section => {
if (section && !section.publisher?.id) {
Expand Down
2 changes: 1 addition & 1 deletion src/adapterManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ adapterManager.callBids = (adUnits, bidRequests, addBidResponse, doneCb, request
let uniqueServerRequests = serverBidderRequests.filter(serverBidRequest => serverBidRequest.uniquePbsTid === uniquePbsTid);

if (s2sAdapter) {
let s2sBidRequest = {'ad_units': adUnitsS2SCopy, s2sConfig, ortb2Fragments};
let s2sBidRequest = {'ad_units': adUnitsS2SCopy, s2sConfig, ortb2Fragments, requestBidsTimeout};
if (s2sBidRequest.ad_units.length) {
let doneCbs = uniqueServerRequests.map(bidRequest => {
bidRequest.start = timestamp();
Expand Down
Loading

0 comments on commit e3f7477

Please sign in to comment.