I want to add a timeout such that if any of these "tasks" takes longer than 5 minutes, it should stop that function and resolve the promise. I've been struggling a bit, any help is appreciated. Thanks!

```
if (require.main === module) {
  (async () => {
    const tasks = [];
    for (let i = 1; i <= NB_PARALLEL; i++) {
      tasks.push(buildReferenceSpaceCollection(json));
    }
    const results = await Promise.all(tasks);
    console.log(results);
    process.exit(0);
  })().catch(console.error);
}

```