postaljs / postal.js

JavaScript pub/sub library supporting advanced subscription features, and several helpful add-ons.
http://ifandelse.com
MIT License
2.83k stars 193 forks source link

Fix subscriptionDefinition cache memory leak #164

Closed crugg closed 7 years ago

crugg commented 7 years ago

We noticed that even with resolverNoCache set to true, we were still leaking memory. We found that the cache keys were still being stored inside SubscriptionDefinitons in the getCacher method.

This also allows users to set postal.configuration.resolverNoCache which will in turn set that in the envelope headers.

With this pull request we are no longer leaking memory.

ifandelse commented 7 years ago

Thanks for this @crugg! I'm trying to catch up on postal-related PRs...have been heads down in a huge work project, so I'm behind on all the things! 😭 I may follow up with a commit to remove the need for _.pick in this case (and just grab the resolverNoCache value directly) - but either way, this leak fix will land as soon as I can cut the next version. Cheers!

ifandelse commented 7 years ago

Merged this locally since I needed to rebase. Thanks again!

crugg commented 7 years ago

No problem! Happy to contribute!