From 9be625fae4e26c2efb39dd8d2e33eaa2b2d5ff0d Mon Sep 17 00:00:00 2001 From: NatureFreshMilk Date: Mon, 25 Feb 2019 07:29:31 +0100 Subject: [PATCH] don't panic, log errors --- server/tilerenderer/renderer.go | 7 +++++++ server/tilerenderer/renderer_test.go | 2 +- server/tilerendererjob/initial.go | 1 - server/tilerendererjob/worker.go | 10 +++++++++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/server/tilerenderer/renderer.go b/server/tilerenderer/renderer.go index cf0a683..26fd6a2 100644 --- a/server/tilerenderer/renderer.go +++ b/server/tilerenderer/renderer.go @@ -128,6 +128,13 @@ func (tr *TileRenderer) renderImage(tc *coords.TileCoords, recursionDepth int) ( img, err := tr.mapblockrenderer.Render(mbr.Pos1, mbr.Pos2) if err != nil { + fields := logrus.Fields{ + "pos1": mbr.Pos1, + "pos2": mbr.Pos2, + "err": err, + } + log.WithFields(fields).Debug("mapblock render from tilerender") + return nil, nil, err } diff --git a/server/tilerenderer/renderer_test.go b/server/tilerenderer/renderer_test.go index 364435a..2b76fc3 100644 --- a/server/tilerenderer/renderer_test.go +++ b/server/tilerenderer/renderer_test.go @@ -2,6 +2,7 @@ package tilerenderer import ( "bytes" + "github.com/sirupsen/logrus" "io/ioutil" "mapserver/colormapping" "mapserver/coords" @@ -14,7 +15,6 @@ import ( "os" "testing" "time" - "github.com/sirupsen/logrus" ) func TestTileRender(t *testing.T) { diff --git a/server/tilerendererjob/initial.go b/server/tilerendererjob/initial.go index 297a047..bc77cac 100644 --- a/server/tilerendererjob/initial.go +++ b/server/tilerendererjob/initial.go @@ -57,7 +57,6 @@ func initialRender(ctx *app.App) { } logrus.WithFields(fields).Info("Initial rendering") - //tile gc ctx.TileDB.GC() diff --git a/server/tilerendererjob/worker.go b/server/tilerendererjob/worker.go index 1388164..553d355 100644 --- a/server/tilerendererjob/worker.go +++ b/server/tilerendererjob/worker.go @@ -21,7 +21,15 @@ func worker(ctx *app.App, coords <-chan *coords.TileCoords, done chan bool) { _, err := ctx.Tilerenderer.Render(tc) if err != nil { - panic(err) + 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") } }