Skip to content

Commit 4252405

Browse files
committed
Merge branch 'sqlitePruningFix' into mergeBunch
2 parents 91f76ab + 5470c79 commit 4252405

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Runtime/Mapbox/BaseModule/Data/Platform/Cache/ISqliteCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Mapbox.BaseModule.Data.Platform.Cache
1010
{
1111
public interface ISqliteCache
1212
{
13-
event Action<string> DataPruned;
13+
event Action<string> DataPrunedForFile;
1414

1515
void ReadySqliteDatabase();
1616
bool IsUpToDate();

Runtime/Mapbox/BaseModule/Data/Platform/Cache/MapboxCacheManager.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public MapboxCacheManager(UnityContext unityContext, MemoryCache memoryCache, Fi
4343

4444
if (_sqLiteCache != null && _textureFileCache != null)
4545
{
46-
_sqLiteCache.DataPruned += path => _textureFileCache.DeleteByFileRelativePath(path);
46+
_sqLiteCache.DataPrunedForFile += path => _textureFileCache.DeleteByFileRelativePath(path);
4747
}
4848

4949
if (_sqLiteCache != null)

Runtime/Mapbox/BaseModule/Data/Platform/Cache/SQLiteCache/SqliteCache.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace Mapbox.BaseModule.Data.Platform.Cache.SQLiteCache
1515
{
1616
public class SqliteCache : ISqliteCache, IDisposable
1717
{
18-
public event Action<string> DataPruned = s => { };
18+
public event Action<string> DataPrunedForFile = s => { };
1919

2020
public const int PruneCacheDelta = 20;
2121

@@ -664,7 +664,7 @@ private void prune()
664664
tiles tile = null;
665665
try
666666
{
667-
var cmd = _sqlite.CreateCommand("SELECT * FROM tiles WHERE rowid IN ( SELECT rowid FROM tiles ORDER BY timestamp ASC LIMIT ? );", toDelete);
667+
var cmd = _sqlite.CreateCommand("SELECT * FROM tiles WHERE tile_path <> '' AND rowid IN ( SELECT rowid FROM tiles ORDER BY timestamp ASC LIMIT ? );", toDelete);
668668
var tilesToDelete = cmd.ExecuteQuery<tiles>();
669669
DeleteFile(tilesToDelete);
670670

@@ -688,7 +688,7 @@ private void DeleteFile(List<tiles> tilesToDelete)
688688
{
689689
foreach (var tile in tilesToDelete)
690690
{
691-
DataPruned(tile.tile_path);
691+
DataPrunedForFile(tile.tile_path);
692692
}
693693
}
694694

0 commit comments

Comments
 (0)