fix tile glitch

This commit is contained in:
NatureFreshMilk 2019-02-22 14:10:41 +01:00
parent dc7c1e58d1
commit 9a249a92e9
4 changed files with 28 additions and 1 deletions

1
server/.gitignore vendored
View File

@ -6,3 +6,4 @@ mapserver.tiles
mapserver.sqlite
mapserver.sqlite-journal
mapserver.json
debug.txt

11
server/tiledb/logger.go Normal file
View File

@ -0,0 +1,11 @@
package tiledb
import (
"github.com/sirupsen/logrus"
)
var log *logrus.Entry
func init() {
log = logrus.WithFields(logrus.Fields{"prefix": "tiledb"})
}

View File

@ -6,6 +6,7 @@ import (
"os"
"strconv"
"sync"
"github.com/sirupsen/logrus"
)
var mutex = &sync.RWMutex{}
@ -38,6 +39,11 @@ func (this *TileDB) GetTile(pos *coords.TileCoords) ([]byte, error) {
mutex.RLock()
defer mutex.RUnlock()
fields := logrus.Fields{
"pos": pos,
}
log.WithFields(fields).Debug("GetTile")
_, file := this.getDirAndFile(pos)
info, _ := os.Stat(file)
if info != nil {
@ -56,6 +62,12 @@ func (this *TileDB) SetTile(pos *coords.TileCoords, tile []byte) error {
mutex.Lock()
defer mutex.Unlock()
fields := logrus.Fields{
"pos": pos,
"size": len(tile),
}
log.WithFields(fields).Debug("SetTile")
dir, file := this.getDirAndFile(pos)
os.MkdirAll(dir, 0700)

View File

@ -72,7 +72,10 @@ func renderMapblocks(ctx *app.App, mblist []*mapblockparser.MapBlock) int {
//spin down worker pool
close(jobs)
<-done
for j := 0; j < ctx.Config.RenderingJobs; j++ {
<-done
}
}
return tilecount