Make diff_state_before default to 0

master
Yohan Boniface 2018-01-26 11:30:28 +01:00
parent 6f99b41d13
commit a8ae4dcbdc
4 changed files with 7 additions and 5 deletions

View File

@ -143,7 +143,7 @@ func (o *_BaseOptions) updateFromConfig() error {
}
}
if conf.DiffStateBefore.Duration != 0 && o.DiffStateBefore == 2*time.Hour {
if conf.DiffStateBefore.Duration != 0 && o.DiffStateBefore == 0 {
o.DiffStateBefore = conf.DiffStateBefore.Duration
}
return nil
@ -226,7 +226,7 @@ func init() {
ImportFlags.BoolVar(&ImportOptions.DeployProduction, "deployproduction", false, "deploy production")
ImportFlags.BoolVar(&ImportOptions.RevertDeploy, "revertdeploy", false, "revert deploy to production")
ImportFlags.BoolVar(&ImportOptions.RemoveBackup, "removebackup", false, "remove backups from deploy")
ImportFlags.DurationVar(&BaseOptions.DiffStateBefore, "diff-state-before", 2*time.Hour, "set initial diff sequence before")
ImportFlags.DurationVar(&BaseOptions.DiffStateBefore, "diff-state-before", 0, "set initial diff sequence before")
DiffFlags.StringVar(&BaseOptions.ExpireTilesDir, "expiretiles-dir", "", "write expire tiles into dir")
DiffFlags.IntVar(&BaseOptions.ExpireTilesZoom, "expiretiles-zoom", 14, "write expire tiles in this zoom level")

View File

@ -210,7 +210,9 @@ To start the update process::
You can stop processing new diff files SIGTERM (``crtl-c``), SIGKILL or SIGHUP. You should create systemd/upstart/init.d service for ``imposm3 run`` to always run in background.
You can change to hourly updates by adding `replication_url: "https://planet.openstreetmap.org/replication/hour/"` and `replication_interval: "1h"` to the Imposm configuration.
You can change to hourly updates by adding `replication_url: "https://planet.openstreetmap.org/replication/hour/"` and `replication_interval: "1h"` to the Imposm configuration. Same for daily updates (works also for Geofabrik updates): `replication_url: "https://planet.openstreetmap.org/replication/day/"` and `replication_interval: "24h"`.
At import time, Imposm compute the first diff sequence number by comparing the PBF input file timestamp and the latest state available in the remote server. Depending on the PBF generation process, this sequence number may not be correct, you can force Imposm to start with an earlier sequence number by adding a `diff_state_before` duration in your conf file. For example, `diff_state_before: 4h` will start with an initial sequence number generated 4 hours before the PBF generation time.
One-time update

View File

@ -174,7 +174,7 @@ func (d *downloader) fetchNextLoop() {
lastTime, err := d.stateTime(stateFile)
for {
nextSeq := d.lastSequence + 1
log.Print("Processing sequence ", nextSeq, err)
log.Print("Processing sequence ", nextSeq)
if err == nil {
nextDiffTime := lastTime.Add(d.interval)
if nextDiffTime.After(time.Now()) {

View File

@ -105,7 +105,7 @@ func FromPbf(filename string, before time.Duration) (*DiffState, error) {
}
// start earlier
seq -= int(before.Minutes())
seq -= int(before.Minutes() / config.BaseOptions.ReplicationInterval.Minutes())
return &DiffState{Time: timestamp, Url: replicationUrl, Sequence: seq}, nil
}