nodeca / promise-memoize

Memoize promise-returning functions. Includes cache expire and prefetch.
MIT License
60 stars 7 forks source link

Update memoize.js #6

Closed cube-drone closed 7 years ago

cube-drone commented 7 years ago

In environments where the event loop takes longer to return than the timeout interval (this is possible with very short timeout intervals or very long running synchronous functions), it's possible for destroyCacheObj to run before askPrefetch, which creates a situation where askPrefetch will crash (and, at least in my case, take the entire application with it).

puzrin commented 7 years ago

Thanks for info & fix. @classam , it would be nice to have this things for merge:

Or wait until i can do that myself (~ week).

puzrin commented 7 years ago

Should be fixed in 1.2.1