I have an Excel file that I read with xlsx, convert data to json like objects and write in firebase with a loop(for), my write function into firebase returns a promise and with this method my UI freezes whenever I send multiple requests (1k+). I've tried to simulate the same code with async await but I get like 1 iteration per second which is very long if you have 100 000+ data.
The solution I'm looking for is to push chunks of data into firebase (I tried with 200 rows of data no problem I get everything in like 2 seconds). I'm resolving my promise but I fear that it is the one causing memory leaks therefore UI freezes.
arr = [{key1: value1, key2:value2,...},...,{keyX,:valueX,...,}]
async uploadFb(arr: Array<object>) {
for (let i = 0; i < arr.length; i++) {
const element = arr[i];
console.log("index is : ", i)
await this._Service.addAsset(element).then(res => {
console.log(res);
})
}
}
and I call my function normally:
this.uploadFb(arr)
the structure I'm hoping to get in firebase is:
