Basically, function must be prefixed with async
keyword if await
used inside it. But if some function just returns Promise and doesn't awaiting for anything, should I mark the function as async
?
Seems like both correct or not?
// with async (returns Promise)
async getActiveQueue() {
return redisClient.zrangeAsync(activeQueue, 0, -1);
}
// difference? Both could be awaited isn't it?
getActiveQueue() {
return redisClient.zrangeAsync(activeQueue, 0, -1);
}