Skip to content

Commit

Permalink
S2s defaults fix in serverbidServerBidAdapter (#1986)
Browse files Browse the repository at this point in the history
* removed s2s defaults

* start timestamp was missing on s2s requests
  • Loading branch information
jaiminpanchal27 authored Dec 20, 2017
1 parent 61f0414 commit d784396
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
13 changes: 5 additions & 8 deletions modules/serverbidServerBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,8 @@ const getConfig = config.getConfig;
const REQUIRED_S2S_CONFIG_KEYS = ['siteId', 'networkId', 'bidders', 'endpoint'];

let _s2sConfig;
config.setDefaults({
's2sConfig': {
enabled: false,
timeout: 1000,
adapter: 'serverbidServer'
}
});

const bidder = 'serverbidServer';

var ServerBidServerAdapter;
ServerBidServerAdapter = function ServerBidServerAdapter() {
Expand Down Expand Up @@ -61,6 +56,8 @@ ServerBidServerAdapter = function ServerBidServerAdapter() {
sizeMap[43] = '300x600';

function setS2sConfig(options) {
if (options.adapter != bidder) return;

let contains = (xs, x) => xs.indexOf(x) > -1;
let userConfig = Object.keys(options);

Expand Down Expand Up @@ -231,6 +228,6 @@ ServerBidServerAdapter.createNew = function() {
return new ServerBidServerAdapter();
};

adaptermanager.registerBidAdapter(new ServerBidServerAdapter(), 'serverbidServer');
adaptermanager.registerBidAdapter(new ServerBidServerAdapter(), bidder);

module.exports = ServerBidServerAdapter;
5 changes: 3 additions & 2 deletions src/adaptermanager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @module adaptermanger */

import { flatten, getBidderCodes, getDefinedParams, shuffle } from './utils';
import { flatten, getBidderCodes, getDefinedParams, shuffle, timestamp } from './utils';
import { resolveStatus } from './sizeMapping';
import { processNativeAdUnitParams, nativeAdapters } from './native';
import { newBidder } from './adapters/bidderFactory';
Expand Down Expand Up @@ -234,6 +234,7 @@ exports.callBids = (adUnits, bidRequests, addBidResponse, doneCb) => {
let s2sBidRequest = {tid, 'ad_units': adUnitsS2SCopy};
if (s2sBidRequest.ad_units.length) {
let doneCbs = serverBidRequests.map(bidRequest => {
bidRequest.start = timestamp();
bidRequest.doneCbCallCount = 0;
return doneCb(bidRequest.bidderRequestId)
});
Expand Down Expand Up @@ -265,7 +266,7 @@ exports.callBids = (adUnits, bidRequests, addBidResponse, doneCb) => {

// handle client adapter requests
clientBidRequests.forEach(bidRequest => {
bidRequest.start = new Date().getTime();
bidRequest.start = timestamp();
// TODO : Do we check for bid in pool from here and skip calling adapter again ?
const adapter = _bidderRegistry[bidRequest.bidderCode];
if (adapter) {
Expand Down

0 comments on commit d784396

Please sign in to comment.