mapserver/tilerendererjob/worker.go

38 lines
751 B
Go
Raw Normal View History

2019-01-24 17:56:37 +03:00
package tilerendererjob
import (
2019-02-21 13:16:01 +03:00
"github.com/sirupsen/logrus"
2019-01-24 17:56:37 +03:00
"mapserver/app"
"mapserver/coords"
)
2019-02-20 12:10:00 +03:00
func worker(ctx *app.App, coords <-chan *coords.TileCoords, done chan bool) {
2019-01-24 17:56:37 +03:00
for tc := range coords {
2019-01-27 20:34:04 +03:00
//render tile
2019-02-19 10:33:38 +03:00
fields := logrus.Fields{
"X": tc.X,
"Y": tc.Y,
"Zoom": tc.Zoom,
"LayerId": tc.LayerId,
2019-02-21 13:16:01 +03:00
"prefix": "tilerenderjob",
2019-02-19 10:33:38 +03:00
}
logrus.WithFields(fields).Debug("Tile render job tile")
2019-09-25 11:22:02 +03:00
err := ctx.Tilerenderer.Render(tc)
2019-01-24 17:56:37 +03:00
if err != nil {
2019-02-25 09:29:31 +03:00
fields := logrus.Fields{
"X": tc.X,
"Y": tc.Y,
"Zoom": tc.Zoom,
"LayerId": tc.LayerId,
"prefix": "tilerenderjob",
"err": err,
}
logrus.WithFields(fields).Error("Tile render job tile")
2019-01-24 17:56:37 +03:00
}
}
2019-02-20 12:10:00 +03:00
done <- true
2019-01-24 17:56:37 +03:00
}