-
Notifications
You must be signed in to change notification settings - Fork 726
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
Remove /auction Endpoint #2033
Remove /auction Endpoint #2033
Conversation
@@ -77,7 +77,7 @@ func (e *EventListener) Listen(cache stored_requests.Cache, events EventProducer | |||
e.onInvalidate() | |||
} | |||
case <-e.stop: | |||
break | |||
return |
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 an unrelated bug. :)
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.
Left a couple of nitpicks. Also, the pbs/usersync.go
file that contains in the "/optout"
endpoint functionality was not removed, can it be relocated to, say endpoints/output.go
in a future PR? Or maybe even renamed to captcha/usersync.go
or something.
@@ -454,14 +222,6 @@ func (a *IxAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalReque | |||
return bidderResponse, errs | |||
} | |||
|
|||
func NewIxLegacyAdapter(config *adapters.HTTPAdapterConfig, endpoint string) *IxAdapter { |
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.
This wasn't even used. Good catch.
@@ -31,698 +24,6 @@ func TestJsonSamples(t *testing.T) { | |||
} | |||
} | |||
|
|||
// Tests for the legacy, non-openrtb code. | |||
// They can be removed after the legacy interface is deprecated. |
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.
Impressed how many lines of code we don't need anymore.
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.
Agreed. Very satisfying.
@@ -49,16 +31,15 @@ import ( | |||
storedRequestsConf "github.com/prebid/prebid-server/stored_requests/config" | |||
"github.com/prebid/prebid-server/usersync" | |||
"github.com/prebid/prebid-server/util/sliceutil" | |||
"github.com/prebid/prebid-server/util/uuidutil" | |||
"github.com/prebid/prebid-server/version" | |||
|
|||
"github.com/golang/glog" | |||
"github.com/julienschmidt/httprouter" | |||
_ "github.com/lib/pq" |
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.
We can probably remove this one too.
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.
I'm not sure. This is initializing the postgres package which we still use for stored requests. I feel more comfortable experimenting with this in a future PR.
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.
Actually, this looks like it's still necessary since it's registering the postgres db driver via the package's init
method.
@@ -107,7 +107,7 @@ func CreateStoredRequests(cfg *config.StoredRequests, metricsEngine metrics.Metr | |||
// | |||
// As a side-effect, it will add some endpoints to the router if the config calls for it. | |||
// In the future we should look for ways to simplify this so that it's not doing two things. | |||
func NewStoredRequests(cfg *config.Configuration, metricsEngine metrics.MetricsEngine, client *http.Client, router *httprouter.Router) (db *sql.DB, shutdown func(), fetcher stored_requests.Fetcher, ampFetcher stored_requests.Fetcher, accountsFetcher stored_requests.AccountFetcher, categoriesFetcher stored_requests.CategoryFetcher, videoFetcher stored_requests.Fetcher) { | |||
func NewStoredRequests(cfg *config.Configuration, metricsEngine metrics.MetricsEngine, client *http.Client, router *httprouter.Router) (shutdown func(), fetcher stored_requests.Fetcher, ampFetcher stored_requests.Fetcher, accountsFetcher stored_requests.AccountFetcher, categoriesFetcher stored_requests.CategoryFetcher, videoFetcher stored_requests.Fetcher) { |
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.
Can we remove DB connection entry that is no longer returned by this function from the comment above?
96 // NewStoredRequests returns five things:
97 //
98 - // 1. A DB connection, if one was created. This may be nil.
99 // 2. A function which should be called on shutdown for graceful cleanups.
100 // 3. A Fetcher which can be used to get Stored Requests for /openrtb2/auction
101 // 4. A Fetcher which can be used to get Stored Requests for /openrtb2/amp
102 // 5. A Fetcher which can be used to get Category Mapping data
103 // 6. A Fetcher which can be used to get Stored Requests for /openrtb2/video
104 //
105 // If any errors occur, the program will exit with an error message.
106 // It probably means you have a bad config or networking issue.
107 //
108 // As a side-effect, it will add some endpoints to the router if the config calls for it.
109 // In the future we should look for ways to simplify this so that it's not doing two things.
110 func NewStoredRequests(cfg *config.Configuration, metricsEngine metrics.MetricsEngine, client *http.Client, router *httprouter.Router) (shutdown func(), fetcher stored_requests.Fetcher, ampFetcher store
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.
Yes. I'll update the comment. Good catch.
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.
LGTM
@SyntaxNode submitted PR SyntaxNode#3 making adform adapter as adf adapter alias. Is such change acceptable here? Should I create separate PR after this one gets merged? |
adapters/pubmatic/pubmatic_test.go
Outdated
func TestGetBidTypeVideo(t *testing.T) { | ||
pubmaticExt := new(pubmaticBidExt) | ||
pubmaticExt.BidType = new(int) | ||
*pubmaticExt.BidType = 1 | ||
actualBidTypeValue := getBidType(pubmaticExt) | ||
if actualBidTypeValue != openrtb_ext.BidTypeVideo { | ||
t.Errorf("Expected Bid Type value was: %v, actual value is: %v", openrtb_ext.BidTypeVideo, actualBidTypeValue) | ||
} | ||
} | ||
|
||
func TestGetBidTypeForMissingBidTypeExt(t *testing.T) { | ||
pubmaticExt := pubmaticBidExt{} | ||
actualBidTypeValue := getBidType(&pubmaticExt) | ||
// banner is the default bid type when no bidType key is present in the bid.ext | ||
if actualBidTypeValue != "banner" { | ||
t.Errorf("Expected Bid Type value was: banner, actual value is: %v", actualBidTypeValue) | ||
} | ||
} | ||
|
||
func TestGetBidTypeBanner(t *testing.T) { | ||
pubmaticExt := new(pubmaticBidExt) | ||
pubmaticExt.BidType = new(int) | ||
*pubmaticExt.BidType = 0 | ||
actualBidTypeValue := getBidType(pubmaticExt) | ||
if actualBidTypeValue != openrtb_ext.BidTypeBanner { | ||
t.Errorf("Expected Bid Type value was: %v, actual value is: %v", openrtb_ext.BidTypeBanner, actualBidTypeValue) | ||
} | ||
} | ||
|
||
func TestGetBidTypeNative(t *testing.T) { | ||
pubmaticExt := new(pubmaticBidExt) | ||
pubmaticExt.BidType = new(int) | ||
*pubmaticExt.BidType = 2 | ||
actualBidTypeValue := getBidType(pubmaticExt) | ||
if actualBidTypeValue != openrtb_ext.BidTypeNative { | ||
t.Errorf("Expected Bid Type value was: %v, actual value is: %v", openrtb_ext.BidTypeNative, actualBidTypeValue) | ||
} | ||
} | ||
|
||
func TestGetBidTypeForUnsupportedCode(t *testing.T) { | ||
pubmaticExt := new(pubmaticBidExt) | ||
pubmaticExt.BidType = new(int) | ||
*pubmaticExt.BidType = 99 | ||
actualBidTypeValue := getBidType(pubmaticExt) | ||
if actualBidTypeValue != openrtb_ext.BidTypeBanner { | ||
t.Errorf("Expected Bid Type value was: %v, actual value is: %v", openrtb_ext.BidTypeBanner, actualBidTypeValue) | ||
} |
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.
Can you please add these required test cases?
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 reviewing the PR. Good catch. These tests have been restored.
I recommend creating a separate PR after this one gets merged. This PR is already large with 10k+ lines affected. |
19017e1
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.
LGTM
This reverts commit fe211a9.
This was accidentally merged earlier than intended. Please see: #2049 |
This reverts commit fe211a9.
This reverts commit fe211a9.
!! Do not merge until the release after #2032 !!
Implements phase 3 of #2011. I ran go-lint to find and remove now unused code, and found a few unrelated dead code references which I removed here too.