add incremental rendering pause config

This commit is contained in:
BuckarooBanzay 2020-04-14 13:43:07 +02:00
parent 06cc766986
commit 9d610681d0
3 changed files with 45 additions and 35 deletions

View File

@ -24,6 +24,7 @@ type Config struct {
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"`
@ -182,6 +183,7 @@ func ParseConfig(filename string) (*Config, error) {
RenderingFetchLimit: 10000,
RenderingJobs: runtime.NumCPU(),
RenderingQueue: 100,
IncrementalRenderingTimer: "5s",
MapObjects: &mapobjs,
MapBlockAccessorCfg: &mapblockaccessor,
DefaultOverlays: defaultoverlays,

View File

@ -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

View File

@ -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
}