From be373985464a0d2ff7db7de4aa6ba74cbc2caed7 Mon Sep 17 00:00:00 2001 From: Oliver Tonnhofer Date: Tue, 2 Jul 2024 16:53:57 +0200 Subject: [PATCH] diff: prevent writing empty expire files --- expire/tilelist.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/expire/tilelist.go b/expire/tilelist.go index 2646703c..0e72453a 100644 --- a/expire/tilelist.go +++ b/expire/tilelist.go @@ -162,7 +162,15 @@ func (tl *TileList) writeTiles(w io.Writer) error { func (tl *TileList) Flush() error { tl.mu.Lock() defer tl.mu.Unlock() - if len(tl.tiles) == 0 { + + foundTiles := false + for _, tiles := range tl.tiles { + if len(tiles) > 0 { + foundTiles = true + break + } + } + if !foundTiles { return nil }