.map
is handy here:
loadActiveChannels: function() {
return Knex('game_channels as ch')
.where('ch.channel_state', '>', 0)
.map(function(channel) {
return redis.hmsetAsync("channel:"+channel.channel_id, _.omit(channel, 'channel_id'))
}).then(function(res) {
console.log(res);
})
}
The reason you don't get any output with your original code is because you have promises.push[promise];
which should have been promises.push(promise)