Open ksze opened 3 years ago
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂
bump
This issue has been automatically marked as stale because it has been open for 7 days without activity. It will be closed if no further activity occurs. If this is still an issue, just leave a comment or remove the "stale" label. 🙂
Issue Creation Checklist
[x] I have read the contribution guidelines
Issue Description
What was unclear/insufficient/not covered in the documentation
It is popular to write asynchronous code in JavaScript. And because
sequelize.query
is async and returns aPromise
, it can be very tempting to write code like this:However, it is not entirely clear from the documentation whether this is supposed to work. I mean, this might accidentally work if the queries are all very short and quick. But what happens if some queries take longer than others? What if the queries are indirectly/implicitly related (e.g.
query2
depending on some changes effected in the database byquery1
). Does sequelize automatically order the queries (in the order that thesequelize.query()
calls were made), even though they look to be fired concurrently? Would the correct functioning depend on how async is implemented in the JavaScript runtime; would it work correctly in node.js but be dangerous in a hypothetical alternative JavaScript runtime that is still conformant to ECMA-262?If possible: Provide some suggestion on how we can enhance the docs
Explicitly explain whether concurrent queries can work correctly (i.e. the way the programmer might expect), maybe under specific conditions - e.g. no indirect/implicit dependency among the queries.