Skip to content

Commit

Permalink
Merge pull request #11630 from marcejohnson/prevent-infinite-loop-req…
Browse files Browse the repository at this point in the history
…uestTileGeometry

Fix Terrain Lockups in requestTileGeometry due to Promise Handling Inconsistencies
  • Loading branch information
jjhembd committed Nov 29, 2023
2 parents ee12834 + 77d7339 commit 8c3e91e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
##### Fixes :wrench:

- Corrected JSDoc and Typescript definitions that marked optional arguments as required in `Cesium3dTileset.fromIonAssetId` [#11623](https://github.com/CesiumGS/cesium/issues/11623), and `IonImageryProvider.fromAssetId` [#11624](https://github.com/CesiumGS/cesium/issues/11624)
- Fixed terrain lockups in `requestTileGeometry` by ensuring promise handling aligns with CesiumJS's expectations. [#11630](https://github.com/CesiumGS/cesium/pull/11630)

### 1.111 - 2023-11-01

Expand Down
3 changes: 3 additions & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
- [Robert Irving](https://github.com/robert-irving-snc)
- [General Atomics CCRi](https://www.ga-ccri.com/)
- [matthias-ccri](https://github.com/matthias-ccri)
- [Terradepth, Inc.](https://www.terradepth.com/)
- [Marc Johnson](https://github.com/marcejohnson)
- [Jacob Frazer](https://github.com/coderjake91)

## [Individual CLA](Documentation/Contributors/CLAs/individual-contributor-license-agreement-v1.0.pdf)

Expand Down
15 changes: 11 additions & 4 deletions packages/engine/Source/Core/CesiumTerrainProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -897,11 +897,18 @@ CesiumTerrainProvider.prototype.requestTileGeometry = function (

if (!defined(layerToUse) && unknownAvailability) {
// Try again when availability data is ready– Otherwise the tile will be marked as failed and never re-requested
return availabilityPromise.then(() =>
this.requestTileGeometry(x, y, level, request)
);
return availabilityPromise.then(() => {
// handle promise or undefined return
return new Promise((resolve) => {
// defer execution to the next event loop
setTimeout(() => {
const promise = this.requestTileGeometry(x, y, level, request);
resolve(promise);
}, 0); // next tick
});
});
}

// call overridden function below
return requestTileGeometry(this, x, y, level, layerToUse, request);
};

Expand Down

0 comments on commit 8c3e91e

Please sign in to comment.