forked from MTSR/mapserver
incremental/initial events
This commit is contained in:
parent
223311e31e
commit
c4ea0bcbaf
@ -8,6 +8,10 @@ import (
|
|||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type IncrementalRenderEvent struct {
|
||||||
|
LastMtime int64 `json:"lastmtime"`
|
||||||
|
}
|
||||||
|
|
||||||
func incrementalRender(ctx *app.App, jobs chan *coords.TileCoords) {
|
func incrementalRender(ctx *app.App, jobs chan *coords.TileCoords) {
|
||||||
|
|
||||||
rstate := ctx.Config.RenderState
|
rstate := ctx.Config.RenderState
|
||||||
@ -39,6 +43,12 @@ func incrementalRender(ctx *app.App, jobs chan *coords.TileCoords) {
|
|||||||
t := time.Now()
|
t := time.Now()
|
||||||
elapsed := t.Sub(start)
|
elapsed := t.Sub(start)
|
||||||
|
|
||||||
|
ev := IncrementalRenderEvent{
|
||||||
|
LastMtime: result.LastMtime,
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.WebEventbus.Emit("incremental-render-progress", &ev)
|
||||||
|
|
||||||
fields := logrus.Fields{
|
fields := logrus.Fields{
|
||||||
"mapblocks": len(result.List),
|
"mapblocks": len(result.List),
|
||||||
"tiles": tiles,
|
"tiles": tiles,
|
||||||
|
@ -7,6 +7,10 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type InitialRenderEvent struct {
|
||||||
|
Progress int `json:"progress"`
|
||||||
|
}
|
||||||
|
|
||||||
func initialRender(ctx *app.App, jobs chan *coords.TileCoords) {
|
func initialRender(ctx *app.App, jobs chan *coords.TileCoords) {
|
||||||
|
|
||||||
rstate := ctx.Config.RenderState
|
rstate := ctx.Config.RenderState
|
||||||
@ -37,6 +41,12 @@ func initialRender(ctx *app.App, jobs chan *coords.TileCoords) {
|
|||||||
rstate.InitialRun = false
|
rstate.InitialRun = false
|
||||||
ctx.Config.Save()
|
ctx.Config.Save()
|
||||||
|
|
||||||
|
ev := InitialRenderEvent{
|
||||||
|
Progress: 100,
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.WebEventbus.Emit("initial-render-progress", &ev)
|
||||||
|
|
||||||
fields := logrus.Fields{
|
fields := logrus.Fields{
|
||||||
"legacyblocks": rstate.LegacyProcessed,
|
"legacyblocks": rstate.LegacyProcessed,
|
||||||
}
|
}
|
||||||
@ -62,6 +72,12 @@ func initialRender(ctx *app.App, jobs chan *coords.TileCoords) {
|
|||||||
|
|
||||||
progress := int(float64(rstate.LegacyProcessed) / float64(totalLegacyCount) * 100)
|
progress := int(float64(rstate.LegacyProcessed) / float64(totalLegacyCount) * 100)
|
||||||
|
|
||||||
|
ev := InitialRenderEvent{
|
||||||
|
Progress: progress,
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.WebEventbus.Emit("initial-render-progress", &ev)
|
||||||
|
|
||||||
fields := logrus.Fields{
|
fields := logrus.Fields{
|
||||||
"mapblocks": len(result.List),
|
"mapblocks": len(result.List),
|
||||||
"tiles": tiles,
|
"tiles": tiles,
|
||||||
|
Loading…
Reference in New Issue
Block a user