From 7a19cd34675afb3f797c01e0c7b01b7f4e8bcc51 Mon Sep 17 00:00:00 2001 From: NatureFreshMilk Date: Fri, 18 Jan 2019 14:21:24 +0100 Subject: [PATCH] dynamic worker count --- initialrenderer/renderer.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/initialrenderer/renderer.go b/initialrenderer/renderer.go index e3480ee..53f507d 100644 --- a/initialrenderer/renderer.go +++ b/initialrenderer/renderer.go @@ -5,6 +5,7 @@ import ( "mapserver/coords" "mapserver/layerconfig" "mapserver/tilerenderer" + "runtime" "time" ) @@ -24,10 +25,15 @@ func Render(tr *tilerenderer.TileRenderer, jobs := make(chan coords.TileCoords, 100) - go worker(tr, jobs) - go worker(tr, jobs) - go worker(tr, jobs) - go worker(tr, jobs) + fields := logrus.Fields{ + "workers": runtime.NumCPU(), + } + logrus.WithFields(fields).Info("Starting initial render progress") + + + for i := 0; i