mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
fix(terrain): bound the client terrain-height cache with LRU eviction
The in-memory cache in the terrain-height resolver had no eviction, so a session retained every coordinate it ever resolved for the lifetime of the page. The 5-decimal rounding documented in the file header makes repeated visits to one place share a key, but it does not bound how many distinct places a session visits. Cap it at 20 000 entries, overridable per instance so the bound is testable without minting twenty thousand coordinates. Eviction is least-recently-used rather than insertion-ordered because revisits here are spatial: the cell the camera is parked on must not be dropped for having been resolved early. The bound sits far above a city-scale session at the ~111 m floor grid, so normal use never evicts and issues no additional proxy requests. Batch results are assembled from what the call resolved, so eviction during a large batch cannot report a just-resolved point as unresolved.
This commit is contained in:
1 parent
2746ec753c
commit
fa9af39e7b
5 files changed
+236
-9
No files matched your search
@@ -609,6 +609,7 @@
|
||||
"src/data/surfaceServices.js",
|
||||
"src/annotations/resolver.js",
|
||||
"src/services/terrainHeights.js",
|
||||
"src/services/terrainHeights.test.mjs",
|
||||
"src/services/groundFloor.js",
|
||||
"src/services/meshFloorSampler.js",
|
||||
"src/services/groundSnap.js",
|
||||
|
||||
Reference in new issue
Block a user