initial rendering disable option

This commit is contained in:
Thomas Rudin 2019-03-29 21:05:53 +01:00
parent ce4ac4dfc9
commit a48e2c2678
2 changed files with 30 additions and 26 deletions

View File

@ -10,18 +10,19 @@ import (
) )
type Config struct { type Config struct {
Port int `json:"port"` Port int `json:"port"`
EnablePrometheus bool `json:"enableprometheus"` EnablePrometheus bool `json:"enableprometheus"`
EnableRendering bool `json:"enablerendering"` EnableRendering bool `json:"enablerendering"`
EnableTransparency bool `json:"enabletransparency"` EnableInitialRendering bool `json:"enableinitialrendering"`
Webdev bool `json:"webdev"` EnableTransparency bool `json:"enabletransparency"`
WebApi *WebApiConfig `json:"webapi"` Webdev bool `json:"webdev"`
Layers []*layer.Layer `json:"layers"` WebApi *WebApiConfig `json:"webapi"`
RenderingFetchLimit int `json:"renderingfetchlimit"` Layers []*layer.Layer `json:"layers"`
RenderingJobs int `json:"renderingjobs"` RenderingFetchLimit int `json:"renderingfetchlimit"`
RenderingQueue int `json:"renderingqueue"` RenderingJobs int `json:"renderingjobs"`
MapObjects *MapObjectConfig `json:"mapobjects"` RenderingQueue int `json:"renderingqueue"`
MapBlockAccessorCfg *MapBlockAccessorConfig `json:"mapblockaccessor"` MapObjects *MapObjectConfig `json:"mapobjects"`
MapBlockAccessorCfg *MapBlockAccessorConfig `json:"mapblockaccessor"`
} }
type MapBlockAccessorConfig struct { type MapBlockAccessorConfig struct {
@ -137,18 +138,19 @@ func ParseConfig(filename string) (*Config, error) {
} }
cfg := Config{ cfg := Config{
Port: 8080, Port: 8080,
EnableRendering: true, EnableRendering: true,
EnablePrometheus: true, EnablePrometheus: true,
EnableTransparency: true, EnableInitialRendering: true,
Webdev: false, EnableTransparency: true,
WebApi: &webapi, Webdev: false,
Layers: layers, WebApi: &webapi,
RenderingFetchLimit: 10000, Layers: layers,
RenderingJobs: runtime.NumCPU(), RenderingFetchLimit: 10000,
RenderingQueue: 100, RenderingJobs: runtime.NumCPU(),
MapObjects: &mapobjs, RenderingQueue: 100,
MapBlockAccessorCfg: &mapblockaccessor, MapObjects: &mapobjs,
MapBlockAccessorCfg: &mapblockaccessor,
} }
info, err := os.Stat(filename) info, err := os.Stat(filename)

View File

@ -13,8 +13,10 @@ func Job(ctx *app.App) {
ctx.Settings.SetInt64(settings.SETTING_LAST_MTIME, time.Now().Unix()) ctx.Settings.SetInt64(settings.SETTING_LAST_MTIME, time.Now().Unix())
} }
if ctx.Settings.GetBool(settings.SETTING_INITIAL_RUN, true) { if ctx.Config.EnableInitialRendering {
initialRender(ctx) if ctx.Settings.GetBool(settings.SETTING_INITIAL_RUN, true) {
initialRender(ctx)
}
} }
incrementalRender(ctx) incrementalRender(ctx)