mapbox / mapbox-gl-native

Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
https://mapbox.com/mobile
Other
4.37k stars 1.33k forks source link

OfflineManager does not detect shared resources between offline packs with parallel downloads #16622

Open sedot42 opened 3 years ago

sedot42 commented 3 years ago

Hi, I am experiencing a potentially expensive issue where I want the user to be able to use several styles offline that all use the same data source. As per Mapbox docs those offline packs should be able to share resources, but when I create the offline packs asynchronously in parallel, tiles are being downloaded multiple times, resulting in higher API usage.

Platform: React Native Mapbox SDK version: 9.1.0

Steps to trigger behavior

  1. Create two offline packs in parallel (async) with different custom styles that use the same tileset as their data source.

Expected behavior

  1. completedTileCount for one pack is about 120.
  2. Check account statistics and see that 120 tiles have been downloaded.

Actual behavior

  1. completedTileCount for one pack is about 120.
  2. Check account statistics and see that 240 tiles have been downloaded.