From 9bf844d2dd7e372640bc66991f8a149a501755a9 Mon Sep 17 00:00:00 2001 From: Oliver Tonnhofer Date: Fri, 25 Nov 2016 09:42:23 +0100 Subject: [PATCH] clear tile list after flush --- expire/tilelist.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/expire/tilelist.go b/expire/tilelist.go index b84fb06..13cc31f 100644 --- a/expire/tilelist.go +++ b/expire/tilelist.go @@ -151,6 +151,8 @@ 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 { return nil } @@ -171,6 +173,7 @@ func (tl *TileList) Flush() error { if err != nil { return err } + tl.tiles = make(map[tileKey]struct{}) // wrote to .tiles~ and now atomically move file to .tiles return os.Rename(fileName, fileName[0:len(fileName)-1]) }