From 8eca70aa5e15a9d425743d203beff00d26427416 Mon Sep 17 00:00:00 2001 From: NatureFreshMilk Date: Fri, 8 Feb 2019 08:14:22 +0100 Subject: [PATCH] db access fixes --- server/mapobjectdb/sqlite/new.go | 1 - server/mapobjectdb/sqlite/sql.go | 1 + server/tilerendererjob/incremental.go | 4 ++-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/mapobjectdb/sqlite/new.go b/server/mapobjectdb/sqlite/new.go index 11acbe9..d636897 100644 --- a/server/mapobjectdb/sqlite/new.go +++ b/server/mapobjectdb/sqlite/new.go @@ -6,7 +6,6 @@ import ( ) func New(filename string) (*Sqlite3Accessor, error) { - //TODO: flag/config for unsafe db access db, err := sql.Open("sqlite3", filename+"?_timeout=500") db.SetMaxOpenConns(1) diff --git a/server/mapobjectdb/sqlite/sql.go b/server/mapobjectdb/sqlite/sql.go index 8160ec1..7f1a706 100644 --- a/server/mapobjectdb/sqlite/sql.go +++ b/server/mapobjectdb/sqlite/sql.go @@ -2,6 +2,7 @@ package sqlite const migrateScript = ` PRAGMA foreign_keys = ON; +PRAGMA journal_mode = TRUNCATE; create table if not exists objects( id integer primary key autoincrement, diff --git a/server/tilerendererjob/incremental.go b/server/tilerendererjob/incremental.go index e703f1a..4d876a1 100644 --- a/server/tilerendererjob/incremental.go +++ b/server/tilerendererjob/incremental.go @@ -36,11 +36,11 @@ func incrementalRender(ctx *app.App, jobs chan *coords.TileCoords) { continue } + tiles := renderMapblocks(ctx, jobs, result.List) + lastMtime = result.LastMtime ctx.Settings.SetInt64(settings.SETTING_LAST_MTIME, lastMtime) - tiles := renderMapblocks(ctx, jobs, result.List) - t := time.Now() elapsed := t.Sub(start)