Avoid infinite source tile cache size

This commit is contained in:
Andreas Hocevar
2021-06-15 20:30:43 +02:00
parent 2361150814
commit cd719ffb34
2 changed files with 15 additions and 0 deletions

View File

@@ -471,6 +471,9 @@ class VectorTile extends UrlTile {
*/
updateCacheSize(tileCount, projection) {
super.updateCacheSize(tileCount * 2, projection);
this.sourceTileCache.highWaterMark = this.getTileCacheForProjection(
projection
).highWaterMark;
}
}

View File

@@ -309,6 +309,18 @@ describe('ol.source.VectorTile', function () {
done();
}, 0);
});
it('adjusts the tile cache size', function (done) {
map.renderSync();
setTimeout(function () {
expect(
source.getTileCacheForProjection(map.getView().getProjection())
.highWaterMark
).to.be(2);
expect(source.sourceTileCache.highWaterMark).to.be(2);
done();
}, 0);
});
});
it('does not fill up the tile queue', function (done) {