3 ms·
Is the idea that you might be fanning out and want to delay starting the event loop? Fanning out in JS looks like: const fn = async (arg) => { ... }; // cal
by hot_gril 3y ago
Is the idea that you might be fanning out and want to delay starting the event loop? Fanning out in JS looks like:
const fn = async (arg) => { ... }; // calls some RPC
const results = await Promise.all(args.map(fn))
which might technically be starting the first func before the second is in the event loop, but I don't see why that matters for what I'm doing.
- gavinhoward 3y agoIt does matter for what I'm doing.
- hot_gril 3y agoYou said most use cases, so I was thinking of a typical backend that's handling requests, calling RPCs, doing DB queries, etc.
- saghm 3y agoIn Rust (which is the async/await system mentioned in the article), futures don't start until they're polled, so doing the pattern you describe wouldn't even have the ordering part you mention (unless you wanted it to, in which case you could use something like Tokio's `spawn`).