From 4c24a016074316d31af4690fa57a232e84a26ab5 Mon Sep 17 00:00:00 2001 From: "Sascha L. Teichmann" Date: Sun, 8 May 2016 23:20:51 +0200 Subject: [PATCH] Use empty structs instead of bools in changes. --- cmd/mtwebmapper/tilesupdater.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/mtwebmapper/tilesupdater.go b/cmd/mtwebmapper/tilesupdater.go index f22cbca..cc44edb 100644 --- a/cmd/mtwebmapper/tilesupdater.go +++ b/cmd/mtwebmapper/tilesupdater.go @@ -29,7 +29,7 @@ type baseTilesUpdates interface { } type tileUpdater struct { - changes map[xz]bool + changes map[xz]struct{} btu baseTilesUpdates mapDir string redisAddress string @@ -89,7 +89,7 @@ func newTileUpdater( mapDir: mapDir, redisAddress: redisAddress, ips: ips, - changes: map[xz]bool{}, + changes: map[xz]struct{}{}, colors: colors, bg: bg, yMin: int16(yMin), @@ -146,7 +146,7 @@ func (tu *tileUpdater) ServeHTTP(rw http.ResponseWriter, r *http.Request) { if len(newChanges) > 0 { tu.cond.L.Lock() for _, c := range newChanges { - tu.changes[c.quantize()] = true + tu.changes[c.quantize()] = struct{}{} } tu.cond.L.Unlock() tu.cond.Signal() @@ -155,7 +155,7 @@ func (tu *tileUpdater) ServeHTTP(rw http.ResponseWriter, r *http.Request) { rw.WriteHeader(http.StatusOK) } -func extractChanges(changes map[xz]bool) []xzc { +func extractChanges(changes map[xz]struct{}) []xzc { chs := make([]xzc, len(changes)) var i int for ch := range changes { @@ -185,7 +185,7 @@ func (tu *tileUpdater) doUpdates() { tu.cond.Wait() } changes := extractChanges(tu.changes) - tu.changes = map[xz]bool{} + tu.changes = map[xz]struct{}{} tu.cond.L.Unlock() baseDir := filepath.Join(tu.mapDir, "8")