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) ctx.WebEventbus.Emit("incremental-render-progress", &ev)
millisDiff := time.Now().Unix() - result.LastMtime
fields := logrus.Fields{ fields := logrus.Fields{
"mapblocks": len(result.List), "mapblocks": len(result.List),
"tiles": tiles, "tiles": tiles,
"elapsed": elapsed, "elapsed": elapsed,
"lastMtime": result.LastMtime, "lastMtime": result.LastMtime,
"secondsDiff": millisDiff / 1000,
} }
logrus.WithFields(fields).Info("incremental rendering") logrus.WithFields(fields).Info("incremental rendering")

View File

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