add incremental rendering pause config
This commit is contained in:
parent
06cc766986
commit
9d610681d0
@ -10,23 +10,24 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
ConfigVersion int `json:"configversion"`
|
||||
Port int `json:"port"`
|
||||
EnablePrometheus bool `json:"enableprometheus"`
|
||||
EnableRendering bool `json:"enablerendering"`
|
||||
EnableSearch bool `json:"enablesearch"`
|
||||
EnableInitialRendering bool `json:"enableinitialrendering"`
|
||||
EnableTransparency bool `json:"enabletransparency"`
|
||||
EnableMediaRepository bool `json:"enablemediarepository"`
|
||||
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"`
|
||||
DefaultOverlays []string `json:"defaultoverlays"`
|
||||
ConfigVersion int `json:"configversion"`
|
||||
Port int `json:"port"`
|
||||
EnablePrometheus bool `json:"enableprometheus"`
|
||||
EnableRendering bool `json:"enablerendering"`
|
||||
EnableSearch bool `json:"enablesearch"`
|
||||
EnableInitialRendering bool `json:"enableinitialrendering"`
|
||||
EnableTransparency bool `json:"enabletransparency"`
|
||||
EnableMediaRepository bool `json:"enablemediarepository"`
|
||||
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"`
|
||||
IncrementalRenderingTimer string `json:"incrementalrenderingtimer"`
|
||||
MapObjects *MapObjectConfig `json:"mapobjects"`
|
||||
MapBlockAccessorCfg *MapBlockAccessorConfig `json:"mapblockaccessor"`
|
||||
DefaultOverlays []string `json:"defaultoverlays"`
|
||||
}
|
||||
|
||||
type MapBlockAccessorConfig struct {
|
||||
@ -168,23 +169,24 @@ func ParseConfig(filename string) (*Config, error) {
|
||||
}
|
||||
|
||||
cfg := Config{
|
||||
ConfigVersion: 1,
|
||||
Port: 8080,
|
||||
EnableRendering: true,
|
||||
EnablePrometheus: true,
|
||||
EnableSearch: true,
|
||||
EnableInitialRendering: true,
|
||||
EnableTransparency: false,
|
||||
EnableMediaRepository: false,
|
||||
Webdev: false,
|
||||
WebApi: &webapi,
|
||||
Layers: layers,
|
||||
RenderingFetchLimit: 10000,
|
||||
RenderingJobs: runtime.NumCPU(),
|
||||
RenderingQueue: 100,
|
||||
MapObjects: &mapobjs,
|
||||
MapBlockAccessorCfg: &mapblockaccessor,
|
||||
DefaultOverlays: defaultoverlays,
|
||||
ConfigVersion: 1,
|
||||
Port: 8080,
|
||||
EnableRendering: true,
|
||||
EnablePrometheus: true,
|
||||
EnableSearch: true,
|
||||
EnableInitialRendering: true,
|
||||
EnableTransparency: false,
|
||||
EnableMediaRepository: false,
|
||||
Webdev: false,
|
||||
WebApi: &webapi,
|
||||
Layers: layers,
|
||||
RenderingFetchLimit: 10000,
|
||||
RenderingJobs: runtime.NumCPU(),
|
||||
RenderingQueue: 100,
|
||||
IncrementalRenderingTimer: "5s",
|
||||
MapObjects: &mapobjs,
|
||||
MapBlockAccessorCfg: &mapblockaccessor,
|
||||
DefaultOverlays: defaultoverlays,
|
||||
}
|
||||
|
||||
info, err := os.Stat(filename)
|
||||
|
@ -43,6 +43,7 @@ The mapserver will generate a fresh `mapserver.json` if there is none at startup
|
||||
"renderingfetchlimit": 1000,
|
||||
"renderingjobs": 2,
|
||||
"renderingqueue": 100,
|
||||
"incrementalrenderingtimer": "5s",
|
||||
"mapobjects": {
|
||||
"bones": true,
|
||||
"protector": true,
|
||||
@ -110,6 +111,9 @@ Number of mapblocks to collect at once while rendering:
|
||||
For a small system (Raspberry PI) a setting of 1000 is ok.
|
||||
Faster system can use the default (10'000)
|
||||
|
||||
#### incrementalrenderingtimer
|
||||
Duration to let pass between incremental rendering executions.
|
||||
|
||||
#### enableprometheus
|
||||
Enables the [Prometheus](./prometheus.md) metrics endpoint
|
||||
|
||||
|
@ -31,7 +31,11 @@ func incrementalRender(ctx *app.App) {
|
||||
}
|
||||
|
||||
if len(result.List) == 0 && !result.HasMore {
|
||||
time.Sleep(5 * time.Second)
|
||||
renderingDuration, err := time.ParseDuration(ctx.Config.IncrementalRenderingTimer)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
time.Sleep(renderingDuration)
|
||||
continue
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user