-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError in async.js after calling clear() #13
Comments
Great thanks for reporting it. I'll look into it shortly |
@medikoo thanks in advance! It looks like after the call to As you can see, this also means that the callbacks are mixed up after the function done1(err, val) {
console.log("done1", val);
}
function done2(err, val) {
console.log("done2", val);
}
asyncmem(1, done1); // waiting = done1
asyncmem.clear(); // waiting is cleared
asyncmem(2, done2); // waiting = done2 The result is: done2 1
TypeError: Cannot read property 'length' of undefined mening the first async call ended and the second callback was called. |
Issue was that unique cache ids were not guaranteed between Fixed and published as v0.3.4 Thanks! |
@medikoo thanks for the quick fix!!! Unfortunately after upgrading to v0.3.4 I still see some TypeErrors in my logs, on both lines 88 and 94. Possibly calling Thanks again! |
@gabmontes please submit working test case. We definitely need to coin that. Even if you're not able to provide minimal case, prepare something that reproduces that. I'll look into it |
@medikoo since upgrading to 0.3.3 from 0.2.x, I am experiencing several
TypeError
's inasync.js
after clearing the cache. The errors are basically two and I was able to consistently reproduce the problem.The following code memoizes an async function
asyncfn
and clears the cache between the two calls:It will always break with
'TypeError: Cannot read property \'length\' of undefined', ' at .../memoizee/ext/async.js:88:67
after the secondasyncmem
call.Now, if
asyncfn
returns an error to its callback by changingcb(null, val);
in line 5 bycb(new Error(), val);
, it will always break with'TypeError: Cannot call method \'forEach\' of undefined', ' at .../memoizee/ext/async.js:94:8
.Both errors are related to calling
clear()
in between two calls. Can you please take a look at this issue and advice how it can be solved?Thanks!!!
The text was updated successfully, but these errors were encountered: