From 4e3579fa05f207f29040fc7109b1002edb5d32a6 Mon Sep 17 00:00:00 2001 From: Sergey Shcherbakov Date: Mon, 24 Jul 2023 10:22:38 +0300 Subject: [PATCH] revert: "feat: PB-804 Redis Fix Option" (#280) :recycle: This reverts commit fe95b4210d287355c521b0c2b9d62e871f6e0ab0. --- endpoints/openrtb2/auction.go | 19 +++++++------ nextmillennium/browser_targeting.go | 3 --- nextmillennium/setBuyerUids.go | 42 ----------------------------- openrtb_ext/request.go | 1 - 4 files changed, 9 insertions(+), 56 deletions(-) delete mode 100644 nextmillennium/setBuyerUids.go diff --git a/endpoints/openrtb2/auction.go b/endpoints/openrtb2/auction.go index 1ece2c8fd4e..068ddc0c03e 100644 --- a/endpoints/openrtb2/auction.go +++ b/endpoints/openrtb2/auction.go @@ -210,6 +210,7 @@ func (deps *endpointDeps) Auction(w http.ResponseWriter, r *http.Request, _ http ctx = ctx_helpers.SetUnitID(ctx, extNextMillennium.UnitID) requestExt.SetNextMillennium(extNextMillennium) } + deps.parseBuyerUIDs(ctx, req) timeout := deps.cfg.AuctionTimeouts.LimitAuctionTimeout(time.Duration(req.TMax) * time.Millisecond) if timeout > 0 { @@ -220,8 +221,6 @@ func (deps *endpointDeps) Auction(w http.ResponseWriter, r *http.Request, _ http ao.TimeoutMS = timeout.Milliseconds() usersyncs := usersync.ParseCookieFromRequest(r, &(deps.cfg.HostCookie)) - deps.parseBuyerUIDs(ctx, req, extNextMillennium, usersyncs) - if req.App != nil { labels.Source = metrics.DemandApp labels.RType = metrics.ReqTypeORTB2App @@ -335,7 +334,7 @@ func (deps *endpointDeps) Auction(w http.ResponseWriter, r *http.Request, _ http } } -func (deps *endpointDeps) parseBuyerUIDs(ctx context.Context, req *openrtb_ext.RequestWrapper, extNmm *openrtb_ext.ExtRequestNextMillennium, usersyncs *usersync.Cookie) { +func (deps *endpointDeps) parseBuyerUIDs(ctx context.Context, req *openrtb_ext.RequestWrapper) { userExt, err := req.GetUserExt() if err != nil { return @@ -345,18 +344,18 @@ func (deps *endpointDeps) parseBuyerUIDs(ctx context.Context, req *openrtb_ext.R if prebid == nil { prebid = &openrtb_ext.ExtUserPrebid{} } - if extNmm == nil { - extNmm = &openrtb_ext.ExtRequestNextMillennium{} - } - if usersyncs == nil { - usersyncs = &usersync.Cookie{} - } if user := req.BidRequest.User; user != nil { if uids, err := deps.redis.Get(ctx, user.BuyerUID); err == nil { var uidsMap map[string]string if err = json.Unmarshal(uids, &uidsMap); err == nil { - nextmillennium.SetBuyerUids(uidsMap, usersyncs, *extNmm, user, prebid) + prebid.BuyerUIDs = make(map[string]string) + for bidder, uid := range uidsMap { + if bidder == "rubicon" && user.BuyerUID == "" { + continue + } + prebid.BuyerUIDs[bidder] = uid + } req.BidRequest.User.BuyerUID = "" } } diff --git a/nextmillennium/browser_targeting.go b/nextmillennium/browser_targeting.go index 3110e06ff57..999c1c2be12 100644 --- a/nextmillennium/browser_targeting.go +++ b/nextmillennium/browser_targeting.go @@ -17,9 +17,6 @@ func contains(s []string, e string) bool { } return false } -func Contains(s []string, e string) bool { - return contains(s, e) -} var deviceTypeInts = map[string]int{ "Computer": 2, diff --git a/nextmillennium/setBuyerUids.go b/nextmillennium/setBuyerUids.go deleted file mode 100644 index a2d1c61e96e..00000000000 --- a/nextmillennium/setBuyerUids.go +++ /dev/null @@ -1,42 +0,0 @@ -package nextmillennium - -import ( - "github.com/mxmCherry/openrtb/v15/openrtb2" - "github.com/prebid/prebid-server/openrtb_ext" - "github.com/prebid/prebid-server/usersync" -) - -func SetBuyerUids(uidsMap map[string]string, usersyncs *usersync.Cookie, extNmm openrtb_ext.ExtRequestNextMillennium, user *openrtb2.User, prebid *openrtb_ext.ExtUserPrebid) { - // if prebid.BuyerUIDs == nil { - prebid.BuyerUIDs = make(map[string]string) - // } - for bidder, uid := range uidsMap { - if bidder == "rubicon" && user.BuyerUID == "" { - continue - } - if user.BuyerUID == "" { - // 1 = partial fix, 2 = full fix - if extNmm.RedisFixBidders[bidder] == 1 && hasCookieUid(bidder, usersyncs) { - continue - } - if extNmm.RedisFixBidders[bidder] == 2 { - continue - } - } - prebid.BuyerUIDs[bidder] = uid - } - -} - -func hasCookieUid(bidder string, usersyncs *usersync.Cookie) bool { - bidderSyncNameMap := map[string]string{ - "appnexus": "adnxs", - "appnexus1": "adnxs", - "oftmedia": "adnxs", - } - bidderSyncName := bidder - if bidderSyncNameMap[bidder] != "" { - bidderSyncName = bidderSyncNameMap[bidder] - } - return usersyncs.HasLiveSync(bidderSyncName) -} diff --git a/openrtb_ext/request.go b/openrtb_ext/request.go index b2f4f0d7759..2b5df723fa1 100644 --- a/openrtb_ext/request.go +++ b/openrtb_ext/request.go @@ -70,7 +70,6 @@ type ExtRequestNextMillennium struct { OverwriteSChain bool `json:"overwriteSChain,omitempty"` ReqDealIds map[string]string `json:"reqDealIds,omitempty"` Comscore bool `json:"comscore,omitempty"` - RedisFixBidders map[string]uint8 `json:"redisFixBidders,omitempty"` } type ExtRequestNextMillenniumGeo struct { Country string `json:"country,omitempty"`