Skip to content

Commit 09172b7

Browse files
committed
fix: correct handling of generated tiles in cache
- added `generated = 0 OR generated IS NULL` filter in `tile_exists?` to exclude temporary generated tiles - changed `cached_tiles_count` to use `exclude(generated: -1)` to ignore technical records - unified `generated` field conditions in queries to the tiles table
1 parent e09ce38 commit 09172b7

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/background_tile_loader.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,10 @@ def get_headers
551551
end
552552

553553
def tile_exists?(x, y, z)
554-
@route[:db][:tiles].where(zoom_level: z, tile_column: x, tile_row: tms_y(z, y)).get(1)
554+
@route[:db][:tiles]
555+
.where(zoom_level: z, tile_column: x, tile_row: tms_y(z, y))
556+
.where(Sequel.lit('generated = 0 OR generated IS NULL'))
557+
.get(1)
555558
end
556559

557560
def miss_permanent?(x, y, z)
@@ -725,7 +728,10 @@ def initialize_zoom_progress
725728
end
726729

727730
def cached_tiles_count(z)
728-
@route[:db][:tiles].where(zoom_level: z).where(Sequel.lit('generated = 0 OR generated IS NULL')).count
731+
@route[:db][:tiles]
732+
.where(zoom_level: z)
733+
.exclude(generated: -1)
734+
.count
729735
end
730736

731737
def zoom_complete?(z)

0 commit comments

Comments
 (0)