Skip to content

Commit faa331e

Browse files
committed
Website updates
1 parent 82a47d0 commit faa331e

7 files changed

Lines changed: 32 additions & 6 deletions

File tree

dist/en/main/examples/common.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/examples/common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/dist/ol.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/dist/ol.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/source/GeoZarr.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ export default class GeoZarr extends DataTileSource<import("../DataTile.js").def
4242
* @private
4343
*/
4444
private consolidatedMetadata_;
45+
/**
46+
* Cache of opened zarrita arrays keyed by path. Caching the Promise
47+
* (not the resolved value) deduplicates concurrent opens for the same
48+
* array path across tiles at the same zoom level.
49+
* @type {Map<string, Promise<import('zarrita').Array<import('zarrita').DataType, any>>>}
50+
* @private
51+
*/
52+
private arrayCache_;
4553
/**
4654
* @type {Array<string>}
4755
* @private

dist/en/main/ol/source/GeoZarr.d.ts.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/en/main/ol/source/GeoZarr.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ export default class GeoZarr extends DataTileSource {
7575
*/
7676
this.consolidatedMetadata_ = null;
7777

78+
/**
79+
* Cache of opened zarrita arrays keyed by path. Caching the Promise
80+
* (not the resolved value) deduplicates concurrent opens for the same
81+
* array path across tiles at the same zoom level.
82+
* @type {Map<string, Promise<import('zarrita').Array<import('zarrita').DataType, any>>>}
83+
* @private
84+
*/
85+
this.arrayCache_ = new Map();
86+
7887
/**
7988
* @type {Array<string>}
8089
* @private
@@ -251,7 +260,16 @@ export default class GeoZarr extends DataTileSource {
251260
const maxRow = Math.round((origin[1] - tileExtent[1]) / bandResolution);
252261

253262
const path = `${this.group_}/${bandMatrixId}/${band}`;
254-
const array = await open(this.root_.resolve(path), {kind: 'array'});
263+
if (!this.arrayCache_.has(path)) {
264+
this.arrayCache_.set(
265+
path,
266+
open(this.root_.resolve(path), {kind: 'array'}).catch((err) => {
267+
this.arrayCache_.delete(path);
268+
throw err;
269+
}),
270+
);
271+
}
272+
const array = await this.arrayCache_.get(path);
255273
bandPromises.push(
256274
get(array, [slice(minRow, maxRow), slice(minCol, maxCol)]),
257275
);

0 commit comments

Comments
 (0)