diff --git a/src/tile/TextureProvider.ts b/src/tile/TextureProvider.ts index 66350736..3b789621 100644 --- a/src/tile/TextureProvider.ts +++ b/src/tile/TextureProvider.ts @@ -45,6 +45,7 @@ export class TextureProvider { private readonly _store: TileStore; private readonly _subscriptions: Map; private readonly _urlSubscriptions: Map; + private readonly _failedLevels: Set; private readonly _renderedLevel: Set; private readonly _rendered: Map; @@ -125,6 +126,7 @@ export class TextureProvider { this._rendered = new Map(); this._subscriptions = new Map(); this._urlSubscriptions = new Map(); + this._failedLevels = new Set(); this._loader = loader; this._store = store; @@ -334,6 +336,10 @@ export class TextureProvider { * retrieve. */ private _fetchTiles(level: number, tiles: TileCoords2D[]): void { + if (this._failedLevels.has(level)) { + return; + } + const urls$ = this._store.hasURLLevel(level) ? observableOf(undefined) : this._loader @@ -343,6 +349,11 @@ export class TextureProvider { if (!this._store.hasURLLevel(level)) { this._store.addURLs(level, ents); } + if (this._failedLevels.size > 0) { + // tslint:disable-next-line:no-console + console.debug(`Tile URL fetch succeeded for level ${level}, resetting failed levels ${[...this._failedLevels.keys()]}`); + this._failedLevels.clear(); + } })); const subscription = urls$.subscribe( @@ -382,6 +393,7 @@ export class TextureProvider { this._urlSubscriptions.delete(level); }, (error: Error): void => { + this._failedLevels.add(level); this._urlSubscriptions.delete(level); // tslint:disable-next-line:no-console console.debug(error); diff --git a/src/tile/TileLoader.ts b/src/tile/TileLoader.ts index 8f9beac1..394e0b3d 100644 --- a/src/tile/TileLoader.ts +++ b/src/tile/TileLoader.ts @@ -7,6 +7,7 @@ import { map, publish, refCount, + retry, } from "rxjs/operators"; import { APIWrapper } from "../api/APIWrapper"; import { ImageTileEnt } from "../api/ents/ImageTileEnt"; @@ -96,6 +97,7 @@ export class TileLoader { const urls$ = this._api .getImageTiles$(request) .pipe( + retry(1), map(contract => contract.node), finalize( () => {