KEMBAR78
Livewrapped Analytics: cleanup analytics cache by patmmccann · Pull Request #13639 · prebid/Prebid.js · GitHub
Skip to content

Conversation

patmmccann
Copy link
Collaborator

robot found a memory leak in the livewrapped auction cache

@github-actions
Copy link

Whoa there, partner! 🌵🤠 We wrangled some duplicated code in your PR:

Reducing code duplication by importing common functions from a library not only makes our code cleaner but also easier to maintain. Please move the common code from both files into a library and import it in each. We hate that we have to mention this, however, commits designed to hide from this utility by renaming variables or reordering an object are poor conduct. We will not look upon them kindly! Keep up the great work! 🚀

@jefftmahoney
Copy link
Collaborator

This looks OK to me. I'm going to approve.

Additional Thoughts

I've been looking around to see how other analytics modules handle cache management, and I actually see very little activity with that.

The r2b2AnalyticsAdapter has a clearCache() function, and the magniteAnalyticsAdapter invokes delete cache.timeouts[auctionId]; from within its subscribeToGamSlots() function, but otherwise I don't see a lot of other analytics modules doing much with clearing their cache.

Which makes me wonder a little bit how and why the robot singled out Livewrapped for its clearing-cache recommendation (perhaps just the way Livewrapped wrote its code clicked on the bot's pattern-recognition learning). I'm also open to the possibility that I'm overthinking this.

@patmmccann
Copy link
Collaborator Author

I had the same thought, and looked into the generic analytics behavior. It doesn't appear to have an issue.

@patmmccann patmmccann merged commit d8ef45b into prebid:master Jul 23, 2025
45 of 48 checks passed
@bjorn-lw
Copy link
Contributor

Unfortunately this clean up doesn't work: If a win is coming in 1500 ms after the auction ended, we won't send the bid notification. Not good at all. While I acknowledge the issue, a better solution must be found and I'm looking at that.

@bjorn-lw
Copy link
Contributor

@patmmccann I can't find a very good solution for this. I see that some adapters, as you mention above, hook up to GAM events to know when it's safe to clean an ad unit from the cache. However, not everyone is running GAM (at least not in our client list).

I guess this is mostly a problem in SPA's, right? Would it be possible to hook up to "ClearAllAuctions"? That would work across all ad servers (or even without an ad server).

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.

3 participants