Skip to content
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

Fix TCF1 Fetcher Fallback #1438

Merged
merged 2 commits into from
Aug 12, 2020
Merged

Conversation

SyntaxNode
Copy link
Contributor

Fixes a bug in 0.124.0 where the TCF1 vendor list fetcher will never attempt lazy loading.

@@ -158,7 +158,7 @@ func newVendorListCache(fallbackVL api.VendorList) (save func(id uint16, list ap
if ok {
return list.(vendorlist.VendorList)
}
return fallbackVL
return nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method needs to return nil in order to attempt a url lazy loading fetch. If we return fallbackVL here, it effectively disables lazy loading.

@@ -196,15 +196,15 @@ func TestDefaultVendorListPassthrough(t *testing.T) {
fetcher := newVendorListFetcher(context.Background(), testcfg, server.Client(), testURLMaker(server), 1)
list, err := fetcher(context.Background(), 2)
assert.NoError(t, err, "Error with fetching existing vendorlist: %v", err)
assert.Equal(t, uint16(2), list.Version(), "Expected to fetch mock list version 2, got version %d", list.Version())
assert.Equal(t, uint16(2), list.Version(), "Expected to fetch mock list version 1, got version %d", list.Version())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't the expected value be uint16(1) instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No,. It should be version 2. I forgot to revert my change to the comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@@ -184,7 +184,7 @@ func TestDefaultVendorListPassthrough(t *testing.T) {
purposes: []int{2},
},
})
server := httptest.NewServer(http.HandlerFunc(mockServer(2, map[int]string{
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both lists were originally preloaded and always pulled from cache. If we change the latest version from 2 to 1, it no longer preloads version 2 and attempts a lazy load. This exposed the bug.

Copy link
Contributor

@guscarreon guscarreon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@guscarreon guscarreon merged commit a4ac6b6 into prebid:master Aug 12, 2020
@SyntaxNode SyntaxNode deleted the fix_default_gvl branch September 10, 2020 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants