incremental/initial events
This commit is contained in:
parent
223311e31e
commit
c4ea0bcbaf
@ -22,7 +22,7 @@ func Parse(data []byte, mtime int64, pos coords.MapBlockCoords) (*MapBlock, erro
|
||||
mapblock.Version = data[0]
|
||||
|
||||
if mapblock.Version < 25 || mapblock.Version > 28 {
|
||||
return nil, errors.New("mapblock-version not supported: " + strconv.Itoa(int(mapblock.Version)))
|
||||
return nil, errors.New("mapblock-version not supported: " + strconv.Itoa(int(mapblock.Version)))
|
||||
}
|
||||
|
||||
//flags
|
||||
@ -46,7 +46,7 @@ func Parse(data []byte, mtime int64, pos coords.MapBlockCoords) (*MapBlock, erro
|
||||
|
||||
} else {
|
||||
offset = 4
|
||||
|
||||
|
||||
}
|
||||
|
||||
//metadata
|
||||
|
@ -8,6 +8,10 @@ import (
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
type IncrementalRenderEvent struct {
|
||||
LastMtime int64 `json:"lastmtime"`
|
||||
}
|
||||
|
||||
func incrementalRender(ctx *app.App, jobs chan *coords.TileCoords) {
|
||||
|
||||
rstate := ctx.Config.RenderState
|
||||
@ -39,6 +43,12 @@ func incrementalRender(ctx *app.App, jobs chan *coords.TileCoords) {
|
||||
t := time.Now()
|
||||
elapsed := t.Sub(start)
|
||||
|
||||
ev := IncrementalRenderEvent{
|
||||
LastMtime: result.LastMtime,
|
||||
}
|
||||
|
||||
ctx.WebEventbus.Emit("incremental-render-progress", &ev)
|
||||
|
||||
fields := logrus.Fields{
|
||||
"mapblocks": len(result.List),
|
||||
"tiles": tiles,
|
||||
|
@ -7,6 +7,10 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type InitialRenderEvent struct {
|
||||
Progress int `json:"progress"`
|
||||
}
|
||||
|
||||
func initialRender(ctx *app.App, jobs chan *coords.TileCoords) {
|
||||
|
||||
rstate := ctx.Config.RenderState
|
||||
@ -37,6 +41,12 @@ func initialRender(ctx *app.App, jobs chan *coords.TileCoords) {
|
||||
rstate.InitialRun = false
|
||||
ctx.Config.Save()
|
||||
|
||||
ev := InitialRenderEvent{
|
||||
Progress: 100,
|
||||
}
|
||||
|
||||
ctx.WebEventbus.Emit("initial-render-progress", &ev)
|
||||
|
||||
fields := logrus.Fields{
|
||||
"legacyblocks": rstate.LegacyProcessed,
|
||||
}
|
||||
@ -62,6 +72,12 @@ func initialRender(ctx *app.App, jobs chan *coords.TileCoords) {
|
||||
|
||||
progress := int(float64(rstate.LegacyProcessed) / float64(totalLegacyCount) * 100)
|
||||
|
||||
ev := InitialRenderEvent{
|
||||
Progress: progress,
|
||||
}
|
||||
|
||||
ctx.WebEventbus.Emit("initial-render-progress", &ev)
|
||||
|
||||
fields := logrus.Fields{
|
||||
"mapblocks": len(result.List),
|
||||
"tiles": tiles,
|
||||
|
Loading…
Reference in New Issue
Block a user