3 ms·
I don't understand the claim that not using async / await and promises with js will block the event loop. Can you elaborate on what you mean?
by dvlsg 10y ago
I don't understand the claim that not using async / await and promises with js will block the event loop. Can you elaborate on what you mean?
- zephyri 10y agoI mean that, in an event loop, synchronous code is blocking code. If you could synchronously run a database query in Node, nothing else would be allowed to execute while you waited. That's why you have to use asynchronous callbacks/promises/generators/await whatever. In Go I can make an apparently synchronous database query without blocking anything except the calling code.