Merge pull request #538 from Salzian/parallel-settings-loading

Parallelized initial settings loading
This commit is contained in:
Lukas Rieger 2024-05-09 12:40:51 +02:00 committed by GitHub
commit 7cdc8213fa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -299,15 +299,17 @@ export class BlueMapApp {
// create maps
if (settings.maps !== undefined){
for (let mapId of settings.maps) {
let loadingPromises = settings.maps.map(mapId => {
let map = new BlueMapMap(mapId, this.dataUrl + mapId + "/", this.loadBlocker, this.mapViewer.events);
maps.push(map);
await map.loadSettings(this.mapViewer.tileCacheHash)
return map.loadSettings(this.mapViewer.tileCacheHash)
.catch(error => {
alert(this.events, `Failed to load settings for map '${map.data.id}':` + error, "warning");
});
}
})
await Promise.all(loadingPromises);
}
// sort maps