dndb icon indicating copy to clipboard operation
dndb copied to clipboard

incorrectly handled async functions

Open ALMaclaine opened this issue 4 years ago • 0 comments

I believe this async section is handled incorrectly:

https://github.com/denyncrawford/dndb/blob/main/src/methods/insert.js#L6

I get un awaited async issues in tests and race conditions for deleting the used file to clean up.

I've done some research and it seems that swallowing the async promises using forEach is risky.

I think it would be better to do await Promise.all(data.map(async e => ....)) or some variation.

ALMaclaine avatar May 23 '21 19:05 ALMaclaine