use timestamp from db

This commit is contained in:
NatureFreshMilk 2019-04-03 08:18:44 +02:00
parent 33d30bc91d
commit 0a986952a8
2 changed files with 12 additions and 10 deletions

View File

@ -49,14 +49,11 @@ func incrementalRender(ctx *app.App) {
ctx.WebEventbus.Emit("incremental-render-progress", &ev)
millisDiff := time.Now().Unix() - result.LastMtime
fields := logrus.Fields{
"mapblocks": len(result.List),
"tiles": tiles,
"elapsed": elapsed,
"lastMtime": result.LastMtime,
"secondsDiff": millisDiff / 1000,
"mapblocks": len(result.List),
"tiles": tiles,
"elapsed": elapsed,
"lastMtime": result.LastMtime,
}
logrus.WithFields(fields).Info("incremental rendering")

View File

@ -3,14 +3,19 @@ package tilerendererjob
import (
"mapserver/app"
"mapserver/settings"
"time"
)
func Job(ctx *app.App) {
lastMtime := ctx.Settings.GetInt64(settings.SETTING_LAST_MTIME, 0)
if lastMtime == 0 {
//mark current time as last incremental render point
ctx.Settings.SetInt64(settings.SETTING_LAST_MTIME, time.Now().Unix())
//mark db time as last incremental render point
lastMtime, err := ctx.Blockdb.GetTimestamp()
if err != nil {
panic(err)
}
ctx.Settings.SetInt64(settings.SETTING_LAST_MTIME, lastMtime)
}
if ctx.Config.EnableInitialRendering {