Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Track failed image tile levels #607

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/tile/TextureProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export class TextureProvider {
private readonly _store: TileStore;
private readonly _subscriptions: Map<string, Subscription>;
private readonly _urlSubscriptions: Map<number, Subscription>;
private readonly _failedLevels: Set<number>;
private readonly _renderedLevel: Set<string>;
private readonly _rendered: Map<string, TileCoords3D>;

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/tile/TileLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
map,
publish,
refCount,
retry,
} from "rxjs/operators";
import { APIWrapper } from "../api/APIWrapper";
import { ImageTileEnt } from "../api/ents/ImageTileEnt";
Expand Down Expand Up @@ -96,6 +97,7 @@ export class TileLoader {
const urls$ = this._api
.getImageTiles$(request)
.pipe(
retry(1),
map(contract => contract.node),
finalize(
() => {
Expand Down
Loading