geotiffjs / geotiff.js

geotiff.js is a small library to parse TIFF files for visualization or analysis. It is written in pure JavaScript, and is usable in both the browser and node.js applications.
https://geotiffjs.github.io/
MIT License
859 stars 179 forks source link

Fix cache handling issues that caused an AggregateError #336

Closed ahocevar closed 1 year ago

ahocevar commented 1 year ago

Fixes #318 and the problems reported in the aftermath of #284.

The problem after #284 is that when the cacheSize is smaller than the number of blocks for one set of requests, blocks that were properly loaded are not available because they were evicted from the cache already. With this change, the last evicted set of blocks is still available during the whole process of fetching a set of blocks.

I also removed the note in the README about setting cacheSize: 0, because quick-lru does not even accept 0 as cache size, and I think the problem that led to that note in the README no longer exists with this pull request.

ahocevar commented 1 year ago

@constantinius Can you please try to prioritize a review on this? The issue fixed here blocks us from updating geotiff.js in OpenLayers. Thanks in advance!

constantinius commented 1 year ago

Thanks @ahocevar