Implementation of a nested asynchronous task queue in Node.js