mapserver/server/tilerendererjob/job.go

40 lines
669 B
Go
Raw Normal View History

2019-01-24 09:52:25 +03:00
package tilerendererjob
import (
"mapserver/app"
"mapserver/coords"
2019-02-07 20:44:40 +03:00
"mapserver/settings"
2019-01-24 09:52:25 +03:00
)
func Job(ctx *app.App) {
2019-02-08 16:25:07 +03:00
initMetrics()
2019-02-08 18:02:24 +03:00
2019-01-24 09:52:25 +03:00
jobs := make(chan *coords.TileCoords, ctx.Config.RenderingQueue)
for i := 0; i < ctx.Config.RenderingJobs; i++ {
go worker(ctx, jobs)
}
2019-02-07 20:44:40 +03:00
if ctx.Settings.GetBool(settings.SETTING_INITIAL_RUN, true) {
2019-01-29 20:00:00 +03:00
//fast, unsafe mode
err := ctx.Objectdb.EnableSpeedSafetyTradeoff(true)
if err != nil {
panic(err)
}
2019-01-24 17:56:37 +03:00
initialRender(ctx, jobs)
2019-01-29 20:00:00 +03:00
//normal, safe mode
err = ctx.Objectdb.EnableSpeedSafetyTradeoff(false)
if err != nil {
panic(err)
}
2019-01-24 17:56:37 +03:00
}
2019-01-24 09:52:25 +03:00
2019-01-24 17:56:37 +03:00
incrementalRender(ctx, jobs)
2019-01-24 09:52:25 +03:00
2019-01-25 19:57:38 +03:00
panic("render job interrupted!")
2019-01-24 09:52:25 +03:00
}