Open piotrj-rtbh opened 1 year ago
I believe this is intentional, with the assumption that waiting to load conversion rates will have more of an impact on revenue than using an inaccurate rate for floors.
The floors module has a setting, auctionDelay
, that currently works as a timeout only for the case when floor data is loaded from the network. We could expand this to mean "wait up to this much for currencies to be loaded" as well.
Alternatively we could introduce a similar settings for the currency module - which would be more appropriate if there are other use cases for currency conversion before the first auction, which I am not aware of.
It seems OP is indeed proposing a currency file timeout. I suggest a default of 0 ms.
Are you suggesting something like this @patmmccann?
pbjs.setConfig({
currency: {
auctionDelay: [...]
}
})
AFAIK right now it's only floors that needs currencies before the first auction, and the currency module never delays it, so this setting would only make sense for this particular situation (using both currency and floors with the delay for the latter). For this reason I am not sure that this is preferable to setConfig({floors: {auctionDelay}})
Goog point, but should setConfig({floors: {auctionDelay}})
control two dependencies, or should they each have their own timeout, eg setConfig({floors: {auctionDelay}})
and setConfig({floors: {auctionCurrencyFileDelay}})
I don't see a point in having two separate controls; if you are delaying the auction anyway, why would you give up on one or the other halfway?
Agreed to go this route:
pbjs.setConfig({
currency: {
auctionDelay: [...]
}
})
Type of issue
Bug: the Price Floors module is not able to properly use the Currency module for converting currencies in bid floors if the exchange rates are taken from an external file (eg. the default one on jsdelivr)
Description
Currency conversion should take place after the currency rate file is loaded so to safely apply the actual rates. Only in certain cases (eg. file could not be loaded or a timeout) the rates should be taken from the currency.defaultRates property. We have noticed that once the currency file is cached then the exchange rates are taken from the file. It happens to load quickly right before the bidRequests are to be processed. Without caching the file is loaded but too late and the floors are calculated with the use of defaultRates only.
Steps to reproduce
bidRequest.getFloor()
method somewhere) and the bidder should accept USD; add also: currency and priceFloors modulesTest page
Codesandbox test page: https://efo8ku.csb.app/?pbjs_debug=true
Expected results
With caching turned on it works as expected. The messages are in that order:
Actual results
With caching turned off the messages are in that order:
Platform details
Prebid 7.34.0, Chrome 109.0.5414.120, Windows 10, Node 14.20.0, npm 6.14.17
Other information