The issue fixed here was the lack of a way to wait for all asynchronous calls to finish, before calculating the vote counts.
The fix was to restructure how the data is retrieved and use Promise.all to wait for all promises to finish before continuing. Calculating the data didn't change, but I did make some small changes to help with performance.
I used Bluebird's Promise.map to make things a bit simpler.
The task being resolved is: https://utopian.io/utopian-io/@firedream/asynchronous-function-call-problem-in-steembotanalysis
Posted on Utopian.io - Rewarding Open Source Contributors