Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Updating offline metadata causes existing offline region to go stale #16450

Open
1ec5 opened this issue Apr 30, 2020 · 4 comments
Open

Updating offline metadata causes existing offline region to go stale #16450

1ec5 opened this issue Apr 30, 2020 · 4 comments
Labels
archived Archived because of inactivity bug offline

Comments

@1ec5
Copy link
Contributor

1ec5 commented Apr 30, 2020

The mbgl::DatabaseFileSource::updateOfflineMetadata() method added in #6338 updates the offline region’s associated metadata in the offline database, but calling it effectively invalidates any mbgl::OfflineRegion the SDK has previously obtained and wrapped in a platform-specific object. Getting that region’s metadata continues to return the same old value without reflecting the change that has taken place in the offline database.

It’s very awkward for the iOS/macOS map SDK to tell developers that calling -[MGLOfflinePack setContext:completionHandler:], as in mapbox/mapbox-gl-native-ios#289, would cause the MGLOfflinePack.context property to become stale and that the only way to get the current context would be to reload the entire set of offline packs by calling -[MGLOfflineStorage reloadPacks] (which calls mbgl::DatabaseFileSource::listOfflineRegions() under the hood).

The mbgl::DatabaseFileSource::updateOfflineMetadata() method’s callback should accept a replacement mbgl::OfflineRegion with the updated metadata. The SDK could then update the MGLOfflinePack’s internal pointer to the mbgl::OfflineRegion with its replacement, and the SDK would remain internally consistent.

/cc @mapbox/gl-native @mapbox/maps-ios

@1ec5

This comment has been minimized.

@1ec5

This comment has been minimized.

@chloekraw
Copy link
Contributor

cc @mapbox/maps-android @zugaldia

@1ec5
Copy link
Contributor Author

1ec5 commented May 1, 2020

mapbox/mapbox-gl-native-ios#289 worked around this issue so that developers don’t need to work around it themselves. However, the workaround may not perform as well as if mbgl would return the updated region.

@stale stale bot added the archived Archived because of inactivity label Nov 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived Archived because of inactivity bug offline
Projects
None yet
Development

No branches or pull requests

2 participants