title: Is it possible to reject each Promise in Promise.allSettled if it takes more than 5 seconds to resolve?
body: <p>I have a Promise.allSettled which i use to resolve data in the database. I have an array of Promises which I run through the Promise.allSettled, then I only use the resolved ones. Is it possible to set a timeout inside the Promise.allSettled, so that if a promise has still not resolved the data after 5 seconds, it should return as rejected?</p>
  <p>My code looks like this:</p>
  <pre><code>await Promise.allSettled(promises)
  .then(result =&gt; result.forEach(d =&gt; {
    if (d.status === 'fulfilled') {
      data.push(d.value)
    }
  }));
  </code></pre>