From 2b85ca06cbdabe95ed08f6927087e9511ff9054a Mon Sep 17 00:00:00 2001 From: Brian Haines Date: Fri, 19 Apr 2024 16:10:28 -0700 Subject: [PATCH 1/2] Unruly: dynamic bid response array size --- adapters/unruly/unruly.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/adapters/unruly/unruly.go b/adapters/unruly/unruly.go index d8a9b04e025..7142b70d127 100644 --- a/adapters/unruly/unruly.go +++ b/adapters/unruly/unruly.go @@ -113,7 +113,8 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest }} } - bidResponse := adapters.NewBidderResponseWithBidsCapacity(5) + count := getBidCount(bidResp) + bidResponse := adapters.NewBidderResponseWithBidsCapacity(count) var errs []error for _, sb := range bidResp.SeatBid { @@ -133,6 +134,14 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest return bidResponse, errs } +func getBidCount(bidResponse openrtb2.BidResponse) int { + c := 0 + for _, sb := range bidResponse.SeatBid { + c = c + len(sb.Bid) + } + return c +} + func getMediaTypeForImp(impId string, imps []openrtb2.Imp) (openrtb_ext.BidType, []error) { var errs []error var noMatchingImps []string From 9c31ea4aca9d841e8cf85a687fb991147d051294 Mon Sep 17 00:00:00 2001 From: Brian Haines Date: Mon, 13 May 2024 12:17:25 -0700 Subject: [PATCH 2/2] Unruly: simply count --- adapters/unruly/unruly.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/adapters/unruly/unruly.go b/adapters/unruly/unruly.go index 7142b70d127..563d6a9ee19 100644 --- a/adapters/unruly/unruly.go +++ b/adapters/unruly/unruly.go @@ -113,8 +113,7 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest }} } - count := getBidCount(bidResp) - bidResponse := adapters.NewBidderResponseWithBidsCapacity(count) + bidResponse := adapters.NewBidderResponseWithBidsCapacity(len(internalRequest.Imp)) var errs []error for _, sb := range bidResp.SeatBid { @@ -134,14 +133,6 @@ func (a *adapter) MakeBids(internalRequest *openrtb2.BidRequest, externalRequest return bidResponse, errs } -func getBidCount(bidResponse openrtb2.BidResponse) int { - c := 0 - for _, sb := range bidResponse.SeatBid { - c = c + len(sb.Bid) - } - return c -} - func getMediaTypeForImp(impId string, imps []openrtb2.Imp) (openrtb_ext.BidType, []error) { var errs []error var noMatchingImps []string