Skip to content

Commit a85db36

Browse files
olegfedorovdevgithub-actions[bot]
authored andcommitted
Log error and assert in debug when multiple tilestores are created (#7556)
We often have an issue when multiple tilestores are created, that causes slowness and problems with offline packs. To help with this, added an error message in this case to log and in debug it will also crash on an assert. If you REALLY need to allow multiple tilestores, set this non persistent setting to true before creating tilestores: `"com.mapbox.common.tilestore.allow_multiple"` Example error message: Error, tile_store]: Creating duplicated TileStore in path '/Users/olegfedorov/Documents/GitHub/mapbox-sdk/projects/common/test/tmp/TileStoreTest/CreateWithDuplicatePath/tile_store'. You have now 2 TileStores created in these locations: '/Users/olegfedorov/Documents/GitHub/mapbox-sdk/projects/common/test/tmp/TileStoreTest/CreateWithDuplicatePath, /Users/olegfedorov/Documents/GitHub/mapbox-sdk/projects/common/test/tmp/TileStoreTest/CreateWithDuplicatePath/tile_store'. This will cause performance issues, please use single TileStore for everything. see https://mapbox.atlassian.net/browse/CORESDK-4012 cc @mapbox/core-sdk GitOrigin-RevId: 0242dbae2a6050132058be492bdcbb657161f6be
1 parent ecfaf69 commit a85db36

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

Tests/MapboxMapsTests/Integration Tests/MapViewIntegrationTestCase.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@ internal class MapViewIntegrationTestCase: IntegrationTestCase {
1717

1818
dataPathURL = try temporaryCacheDirectory()
1919

20+
// allow multiple tilestore folders
21+
let ss = SettingsServiceFactory.getInstance(storageType: SettingsServiceStorageType.nonPersistent)
22+
let result = ss.set(key: "com.mapbox.common.tilestore.allow_multiple", value: true)
23+
switch result {
24+
case .success:
25+
print("Allowed multiple tilestores")
26+
27+
case .failure(let error):
28+
print("Error allowing multiple tilestores: \(String(describing: error.errorDescription))")
29+
}
30+
2031
guard let window = window,
2132
let rootView = rootViewController?.view else {
2233
XCTFail("No valid UIWindow or root view controller")

0 commit comments

Comments
 (0)