Let's say we have this buggy function:
async function buggy() {
while(true) {
await new Promise(resolve => setTimeout(resolve, 1000));
}
}
If you call it somewhere in NodeJS, would it permanently impact the server performances ?
If so, would it be better to always put a fail-safe mechanism like so for all untrusted promises:
new Promise((resolve, reject) => {
buggy().then(() => resolve);
setTimeout(reject, 10000);
};