Basically was hoping Promise.map().then() would run after all the mapped promises, however the then is running immediately.
https://gist.github.com/bag-man/4b5db93b3c9c5e38876946d36c89331f#file-import-js-L32-L45
resultSet.map( item => {
Promise.coroutine( function* (user) {
let opt = {
TableName: 'tableName',
KeyConditions: {
username: {
AttributeValueList: [user],
ComparisonOperator: 'EQ'
}
},
ProjectionExpression: 'firstname, lastname',
}
let userFriends = yield dynamodb.queryAsync(opt)
/* random code here to assign first name and last name to item */
})(item);
return item
});
concurrency = 1
and only allow one function at a time?
.then()/.catch()
syntax with async/await/throw.