add log + use allSettled

This commit is contained in:
MathieuG-P
2023-03-01 23:26:48 +01:00
parent 363cc3cc5e
commit a56fdde0e7
5 changed files with 12 additions and 9 deletions
@@ -135,8 +135,6 @@ export class LocalMapsManagerService {
return new Observable<BsmLocalMapsProgress>(observer => {
(async () => {
console.time()
const levelsFolder = await this.getMapsFolderPath(version);
const levelsPaths = (await this.utils.pathExist(levelsFolder)) ? this.utils.listDirsInDir(levelsFolder, true) : [];
@@ -151,14 +149,18 @@ export class LocalMapsManagerService {
return mapInfo;
});
const mapsInfo = (await Promise.all(promises)).filter(info => info);
const mapsInfo = (await Promise.allSettled(promises)).reduce((acc, mapInfo) => {
if(mapInfo.status === "fulfilled" && mapInfo.value){
acc.push(mapInfo.value);
}
return acc;
} ,[] as BsmLocalMap[]);
progression.maps = mapsInfo;
observer.next(progression);
observer.complete();
console.timeEnd();
})();
});
}
-1
View File
@@ -47,7 +47,6 @@ export class IpcService {
observable.subscribe(data => {
this.send(channel, window, data);
}, error => {
console.log("LAAAA 2", error);
this.send(this.getErrorChannel(channel), window, error);
}, () => {
this.send(this.getCompleteChannel(channel), window);
@@ -32,7 +32,7 @@ export class BeatSaverService {
return res;
}, [] as BsvMapDetail[]);
await Promise.all(chunkHash.map(async hashs => {
await Promise.allSettled(chunkHash.map(async hashs => {
const res = await this.bsaverApi.getMapsDetailsByHashs(hashs);
if(res.status === 200){