-
Notifications
You must be signed in to change notification settings - Fork 806
New Adapter: UNICORN #1719
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Adapter: UNICORN #1719
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for reading the our new bidder docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. A couple of comments before approving
adapters/unicorn/unicorn.go
Outdated
return nil, []error{err} | ||
} | ||
|
||
request.Source.Ext = setSourceExt() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prebid server core passes a shallow copy of the openrtb.BidRequest
object to the MakeRequest()
function which makes pointer fields like Source
to be red flags because they point to shared memory.
14 type BidRequest struct {
15
.
.
185
186 // Attribute:
187 // source
188 // Type:
189 // object
190 // Description:
191 // A Sorce object (Section 3.2.2) that provides data about the
192 // inventory source and which entity makes the final decision.
193 Source *Source `json:"source,omitempty"`
.
.
211 }
~/go/pkg/mod/github.com/mxm!cherry/[email protected]+incompatible/bid_request.go [RO]
Please create a new Source object copy locally and assign to the bidRequest
. Notice that, depending on its initial configuration, prebid server core may or may not initialize bidRequest.Source
field if it comes with a nil
value (see endpoints/openrtb2/auction.go
's line 311). In summary, we could do something like:
67 err := modifyImps(request, requestInfo)
68 if err != nil {
69 return nil, []error{err}
70 }
71
72 - request.Source.Ext = setSourceExt()
+ if request.Source != nil {
+ modifiableSource = *request.Source
+ } else {
+ modifiableSource = &openrtb.Source{}
+ }
+ modifiableSource.Ext = setSourceExt()
+ request.Source = modifiableSource
73
74 request.Ext, err = setExt(request)
75 if err != nil {
76 return nil, []error{err}
77 }
adapters/unicorn/unicorn.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it. Thank you so much!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed again because there is have copying source problem.
adapters/unicorn/unicorn.go
Outdated
return headers | ||
} | ||
|
||
func modifyImps(request *openrtb.BidRequest, requestInfo *adapters.ExtraRequestInfo) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The second parameter requestInfo *adapters.ExtraRequestInfo
seems to not be used by this function at all. Do we need it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Certainly, requestInfo *adapters.ExtraRequestInfo
is not used. Fixed it. Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@faithnh thank you for addressing the feedback. Your adapter looks pretty solid
Also fixed doc: prebid/prebid.github.io#2710