[Tile-serving] [openstreetmap/osm2pgsql] add a 'status' command which prints the lag (& in JSON) (#1548)
Amanda
notifications at github.com
Tue Aug 17 11:37:28 UTC 2021
@amandasaurus commented on this pull request.
> + if cur.rowcount != 1:
+ results['error'] = {
+ 'text': {'en': "Updates not set up correctly. Run 'osm2pgsql-updates init' first."},
+ 'code': (1 << 1)
+ }
+ else:
+
+ base_url, db_seq, db_ts = cur.fetchone()
+ db_ts = db_ts.astimezone(dt.timezone.utc)
+ results['server']['base_url'] = base_url
+ results['local']['sequence'] = db_seq
+ results['local']['timestamp'] = db_ts.strftime("%Y-%m-%dT%H:%M:%SZ")
+
+
+ repl = ReplicationServer(base_url)
+ server_seq, server_ts = repl.get_state_info()
Done. I had presumed that pyosmium would raise an exception. 😉
--
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#discussion_r690285902
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20210817/2e7ff950/attachment.htm>
More information about the Tile-serving
mailing list