From ee640d3ca74d0e7a462645e27bf55131f4b84e38 Mon Sep 17 00:00:00 2001 From: EvgeniiMunin Date: Fri, 13 Dec 2024 10:52:03 -0800 Subject: [PATCH] fallback to RTD maxmind to get country --- .../time/data/core/GreenbidsInferenceDataService.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/core/GreenbidsInferenceDataService.java b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/core/GreenbidsInferenceDataService.java index 3bd3e37b859..b0303f16d69 100644 --- a/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/core/GreenbidsInferenceDataService.java +++ b/extra/modules/greenbids-real-time-data/src/main/java/org/prebid/server/hooks/modules/greenbids/real/time/data/core/GreenbidsInferenceDataService.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode; import com.iab.openrtb.request.BidRequest; import com.iab.openrtb.request.Device; +import com.iab.openrtb.request.Geo; import com.iab.openrtb.request.Imp; import com.maxmind.geoip2.DatabaseReader; import com.maxmind.geoip2.exception.GeoIp2Exception; @@ -86,12 +87,16 @@ private List extractMessagesForImp( final String ip = Optional.ofNullable(bidRequest.getDevice()) .map(Device::getIp) .orElse(null); - final String countryFromIp = getCountry(ip); + final String country = Optional.ofNullable(bidRequest.getDevice()) + .map(Device::getGeo) + .map(Geo::getCountry) + .orElse(getCountry(ip)); + return createThrottlingMessages( bidderNode, impId, greenbidsUserAgent, - countryFromIp, + country, hostname, hourBucket, minuteQuadrant);