1
0
forked from MTSR/mapserver

rendering limit params

This commit is contained in:
NatureFreshMilk 2019-01-21 13:45:35 +01:00
parent 13cab545b1
commit 1c8694c906
9 changed files with 54 additions and 49 deletions

View File

@ -17,6 +17,8 @@ type Config struct {
WebApi *WebApiConfig `json:"webapi"`
RenderState *RenderStateType `json:"renderstate"`
Layers []layer.Layer `json:"layers"`
InitialRenderingFetchLimit int `json:"initialrenderingfetchlimit"`
UpdateRenderingFetchLimit int `json:"updaterenderingfetchlimit"`
}
type WebApiConfig struct {
@ -72,9 +74,9 @@ func ParseConfig(filename string) (*Config, error) {
rstate := RenderStateType{
InitialRun: true,
LastX: coords.MinCoord-1,
LastY: coords.MinCoord-1,
LastZ: coords.MinCoord-1,
LastX: coords.MinCoord - 1,
LastY: coords.MinCoord - 1,
LastZ: coords.MinCoord - 1,
LastMtime: 1,
}
@ -95,6 +97,8 @@ func ParseConfig(filename string) (*Config, error) {
WebApi: &webapi,
RenderState: &rstate,
Layers: layers,
InitialRenderingFetchLimit: 10000,
UpdateRenderingFetchLimit: 10000,
}
info, err := os.Stat(filename)

View File

@ -1,8 +1,8 @@
package coords
import (
"math"
"mapserver/layer"
"math"
)
const (

View File

@ -1,9 +1,9 @@
package coords
import (
"testing"
"mapserver/layer"
"github.com/stretchr/testify/assert"
"mapserver/layer"
"testing"
)
func TestConvertMapblockToTile1(t *testing.T) {

View File

@ -17,7 +17,7 @@ func Job(ctx *app.App) {
lastcoords := coords.NewMapBlockCoords(rstate.LastX, rstate.LastY, rstate.LastZ)
for true {
newlastcoords, mblist, err := ctx.BlockAccessor.FindLegacyMapBlocks(lastcoords, 10000)
newlastcoords, mblist, err := ctx.BlockAccessor.FindLegacyMapBlocks(lastcoords, ctx.Config.InitialRenderingFetchLimit)
if err != nil {
panic(err)

View File

@ -2,8 +2,8 @@ package mapblockparser
import (
"errors"
"strconv"
"mapserver/coords"
"strconv"
)
func Parse(data []byte, mtime int64, pos coords.MapBlockCoords) (*MapBlock, error) {

View File

@ -3,9 +3,9 @@ package mapblockparser
import (
"fmt"
"io/ioutil"
"mapserver/coords"
"strconv"
"testing"
"mapserver/coords"
)
func TestReadU16(t *testing.T) {
@ -39,7 +39,7 @@ func TestParse(t *testing.T) {
t.Error(err)
}
mapblock, err := Parse(data, 0, coords.NewMapBlockCoords(0,0,0))
mapblock, err := Parse(data, 0, coords.NewMapBlockCoords(0, 0, 0))
if err != nil {
t.Error(err)
@ -70,7 +70,7 @@ func TestParse2(t *testing.T) {
t.Error(err)
}
mapblock, err := Parse(data, 0, coords.NewMapBlockCoords(0,0,0))
mapblock, err := Parse(data, 0, coords.NewMapBlockCoords(0, 0, 0))
if err != nil {
t.Error(err)
@ -88,7 +88,7 @@ func TestParse3(t *testing.T) {
t.Error(err)
}
_, err = Parse(data, 0, coords.NewMapBlockCoords(0,0,0))
_, err = Parse(data, 0, coords.NewMapBlockCoords(0, 0, 0))
if err != nil {
t.Error(err)

View File

@ -7,9 +7,9 @@ import (
"mapserver/colormapping"
"mapserver/coords"
"mapserver/db"
"mapserver/layer"
"mapserver/mapblockaccessor"
"mapserver/testutils"
"mapserver/layer"
"os"
"testing"
)

View File

@ -17,7 +17,7 @@ func Job(ctx *app.App) {
logrus.WithFields(fields).Info("Starting incremental update")
for true {
mblist, err := ctx.BlockAccessor.FindLatestMapBlocks(rstate.LastMtime, 10000)
mblist, err := ctx.BlockAccessor.FindLatestMapBlocks(rstate.LastMtime, ctx.Config.UpdateRenderingFetchLimit)
if err != nil {
panic(err)
@ -71,6 +71,7 @@ func Job(ctx *app.App) {
if len(mblist) > 0 {
fields = logrus.Fields{
"count": len(mblist),
"validcount": len(validmblist),
"lastmtime": rstate.LastMtime,
}
logrus.WithFields(fields).Info("incremental update")