Skip to content

PS bid caching failures - #943

Open
mdanylov-sigma wants to merge 2 commits into
masterfrom
feature/1258-cache-bid-failures
Open

PS bid caching failures#943
mdanylov-sigma wants to merge 2 commits into
masterfrom
feature/1258-cache-bid-failures

Conversation

@mdanylov-sigma

Copy link
Copy Markdown
Collaborator

cache.bids = Bids.fromJSONObject(jsonObject.optJSONObject("bids"));
cache.vastXml = Bids.fromJSONObject(jsonObject.optJSONObject("vastXml"));
if (!cache.vastXml.hasCacheData()) {
cache.vastXml = Bids.fromJSONObject(jsonObject.optJSONObject("vastxml"));

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Is it possible that the variable will be in different cases: vastXml and vastxml?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

According to the PBS docs, the request extension is ext.prebid.cache.vastxml, while the response extension is seatbid.bid.ext.prebid.cache.vastXml. Since this parser handles responses, only vastXml field is needed. I kept vastxml as a compatibility fallback, but updated the implementation to select the non-null JSON object first and parse once.

cache.url = jsonObject.optString("url");
cache.bids = Bids.fromJSONObject(jsonObject.optJSONObject("bids"));
cache.vastXml = Bids.fromJSONObject(jsonObject.optJSONObject("vastXml"));
if (!cache.vastXml.hasCacheData()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It will be more readable and faster, if we first call optJSONObject to find a non-nullable VAST XML object, then call hasCacheData .

}
}

seatbids = filteredSeatbids;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The implementation looks correct, but recreating the bids list can be time-consuming. Maybe it'll be simpler to move this logic to the parseJson method and do not add non-cached bids. Or do we have some limitations?

@mdanylov-sigma
mdanylov-sigma force-pushed the feature/1258-cache-bid-failures branch from 54281ec to b8e0080 Compare July 3, 2026 12:34
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.

2 participants