medikoo / memoizee

Complete memoize/cache solution for JavaScript
ISC License
1.73k stars 61 forks source link

Add support for removing cancelled bluebird3 promises from the cache. #97

Closed Page- closed 6 years ago

Page- commented 6 years ago

When a bluebird3 promise is cancelled it doesn't call any success/failure handles which means that it appears to be permanently waiting in terms of the cache and will be given out to every subsequent call. This is a problem as when you try to subscribe to the returned, cancelled, promise it rejects with a CancellationError so we end up with a poisoned cache. This PR checks if the promise can attach cancellation handlers and if so we attach the onFailure handler to clean up in case of cancellation

Page- commented 6 years ago

The lint is now failing due to an update in https://github.com/medikoo/eslint-config-medikoo - how would you like the lint cases fixed?

medikoo commented 6 years ago

The lint is now failing due to an update in https://github.com/medikoo/eslint-config-medikoo - how would you like the lint cases fixed?

I've fixed this in master. Issue was related to recent eslint upgrade (v4 -> v5). Therefore merge, and lint should be ok

Page- commented 6 years ago

I picked up the master changes and all the tests look good now

medikoo commented 6 years ago

Thank you, published with v0.4.13

Page- commented 6 years ago

Awesome, thanks!