[Tile-serving] [openstreetmap/osm2pgsql] add an 'info' command which prints the lag (& in JSON) (#1548)

Amanda notifications at github.com
Wed Aug 4 14:24:48 UTC 2021


This patch adds an `info` command which prints readable summary of the state of replication:

```
$ osm2pgsql-replication info -U osm -d gis
2021-08-04 14:12:28 [INFO]: Using replication service 'https://download.geofabrik.de/europe-updates/'. Current sequence 3052 (2021-08-03T20:21:39Z).
2021-08-04 14:12:28 [INFO]: Server is at sequence 3052 (2021-08-03T20:21:39Z)
2021-08-04 14:12:28 [INFO]: Server's most recent data is 17 hour(s) 50 minutes(s) old
2021-08-04 14:12:28 [INFO]: Database is up to date with server
2021-08-04 14:12:28 [INFO]: Database's most recent data is 17 hour(s) 50 minutes(s) old
```

with the `--json` option, the output is in JSON format, which is useful for writing scripts to detect if the replication has stopped, or to graph how far behind the server is:

`$ osm2pgsql-replication info -U osm -d gis --json`:
```json
{
  "server": {
    "base_url": "https://download.geofabrik.de/europe-updates/",
    "sequence": 3052,
    "timestamp": "2021-08-03T20:21:39Z",
    "age": {
      "seconds": 64920,
      "text": {
        "en": "18 hour(s) 2 minutes(s)"
      }
    }
  },
  "local": {
    "sequence": 3052,
    "timestamp": "2021-08-03T20:21:39Z",
    "age": {
      "seconds": 64920,
      "text": {
        "en": "18 hour(s) 2 minutes(s)"
      }
    }
  },
  "diff": {
    "sequence": 0,
    "timestamp": {
      "seconds": 0,
      "text": {
        "en": "0 minutes(s)"
      }
    }
  }
}
```
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/osm2pgsql/pull/1548

-- Commit Summary --

  * add an 'info' command which prints the lag etc

-- File Changes --

    M docs/osm2pgsql-replication.1 (77)
    M scripts/osm2pgsql-replication (106)

-- Patch Links --

https://github.com/openstreetmap/osm2pgsql/pull/1548.patch
https://github.com/openstreetmap/osm2pgsql/pull/1548.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/1548
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20210804/f292851b/attachment.htm>


More information about the Tile-serving mailing list