It may be a naive question, but I'm confused with the promise behavior
See original GitHub issueSo I have a middleware doing something like this:
module.exports = async(ctx, next) => {
dbOperation();
dbOperation();
dbOperation();
dbOperation();
dbOperation();
await next();
}
And I see that not all dbOperations are being executed, but if I change to this:
module.exports = async(ctx, next) => {
await dbOperation();
await dbOperation();
await dbOperation();
await dbOperation();
await dbOperation();
await next();
}
Then it works, so is the request finishing before all Promises are correctly dispatched?
Issue Analytics
- State:
- Created 7 years ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
TIP 61 Behavioral Health Services for American Indians and ...
This Treatment Improvement Protocol (TIP) serves as a primer for working with individuals who identify with American Indian and Alaska Native cultures. It...
Read more >5 Sneaky Behaviors That Are Actually Unhealthy
The following are five common cloaks that could be concealing your partner's covert abuse. 1. Obliviousness. Some people are undeniably spacey, but when...
Read more >Toxic People: 12 Things They Do and How to Deal with Them ...
We've all had toxic people dust us with their poison. Sometimes it's more like a drenching. Know these 12 signs to avoid falling...
Read more >Master List of Logical Fallacies
Fallacies are fake or deceptive arguments, "junk cognition," that is, arguments that seem irrefutable but prove nothing. Fallacies often seem superficially ...
Read more >The Four Horsemen: Defensiveness - The Gottman Institute
One of the Four Horsemen, Defensiveness, is righteous indignation or innocent victimhood in an attempt to ward off a perceived attack.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yea if you don’t need to wait, then just doing
doOperation()
is fine, but you’ll want todoOperation().catch(fn)
to have some sort of error loggingThanks for all the great tips, guys!