From a48e2c2678e585ca22e10cc8d912a75c8ad99d04 Mon Sep 17 00:00:00 2001 From: Thomas Rudin Date: Fri, 29 Mar 2019 21:05:53 +0100 Subject: [PATCH] initial rendering disable option --- server/app/config.go | 50 ++++++++++++++++++----------------- server/tilerendererjob/job.go | 6 +++-- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/server/app/config.go b/server/app/config.go index 50e0cec..7693e6e 100644 --- a/server/app/config.go +++ b/server/app/config.go @@ -10,18 +10,19 @@ import ( ) type Config struct { - Port int `json:"port"` - EnablePrometheus bool `json:"enableprometheus"` - EnableRendering bool `json:"enablerendering"` - EnableTransparency bool `json:"enabletransparency"` - Webdev bool `json:"webdev"` - WebApi *WebApiConfig `json:"webapi"` - Layers []*layer.Layer `json:"layers"` - RenderingFetchLimit int `json:"renderingfetchlimit"` - RenderingJobs int `json:"renderingjobs"` - RenderingQueue int `json:"renderingqueue"` - MapObjects *MapObjectConfig `json:"mapobjects"` - MapBlockAccessorCfg *MapBlockAccessorConfig `json:"mapblockaccessor"` + Port int `json:"port"` + EnablePrometheus bool `json:"enableprometheus"` + EnableRendering bool `json:"enablerendering"` + EnableInitialRendering bool `json:"enableinitialrendering"` + EnableTransparency bool `json:"enabletransparency"` + Webdev bool `json:"webdev"` + WebApi *WebApiConfig `json:"webapi"` + Layers []*layer.Layer `json:"layers"` + RenderingFetchLimit int `json:"renderingfetchlimit"` + RenderingJobs int `json:"renderingjobs"` + RenderingQueue int `json:"renderingqueue"` + MapObjects *MapObjectConfig `json:"mapobjects"` + MapBlockAccessorCfg *MapBlockAccessorConfig `json:"mapblockaccessor"` } type MapBlockAccessorConfig struct { @@ -137,18 +138,19 @@ func ParseConfig(filename string) (*Config, error) { } cfg := Config{ - Port: 8080, - EnableRendering: true, - EnablePrometheus: true, - EnableTransparency: true, - Webdev: false, - WebApi: &webapi, - Layers: layers, - RenderingFetchLimit: 10000, - RenderingJobs: runtime.NumCPU(), - RenderingQueue: 100, - MapObjects: &mapobjs, - MapBlockAccessorCfg: &mapblockaccessor, + Port: 8080, + EnableRendering: true, + EnablePrometheus: true, + EnableInitialRendering: true, + EnableTransparency: true, + Webdev: false, + WebApi: &webapi, + Layers: layers, + RenderingFetchLimit: 10000, + RenderingJobs: runtime.NumCPU(), + RenderingQueue: 100, + MapObjects: &mapobjs, + MapBlockAccessorCfg: &mapblockaccessor, } info, err := os.Stat(filename) diff --git a/server/tilerendererjob/job.go b/server/tilerendererjob/job.go index 1d3a092..0532708 100644 --- a/server/tilerendererjob/job.go +++ b/server/tilerendererjob/job.go @@ -13,8 +13,10 @@ func Job(ctx *app.App) { ctx.Settings.SetInt64(settings.SETTING_LAST_MTIME, time.Now().Unix()) } - if ctx.Settings.GetBool(settings.SETTING_INITIAL_RUN, true) { - initialRender(ctx) + if ctx.Config.EnableInitialRendering { + if ctx.Settings.GetBool(settings.SETTING_INITIAL_RUN, true) { + initialRender(ctx) + } } incrementalRender(ctx)