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

Sarah Hoffmann notifications at github.com
Wed Aug 18 09:26:02 UTC 2021


@lonvia commented on this pull request.



> +            LOG.fatal(results['error']['text']['en'])
+            return results['error']['code']
+
+        LOG.info("Using replication service '%s'. Current sequence %d (%s).",
+                 results['server']['base_url'], results['local']['sequence'], results['local']['timestamp'])
+        LOG.info("Server is at sequence %d (%s)", results['server']['sequence'], results['server']['timestamp'])
+        LOG.info("Server's most recent data is %s old", results['server']['age']['text']['en'])
+
+        if results['local']['sequence'] == results['server']['sequence']:
+            LOG.info("Database is up to date with server")
+        else:
+            LOG.info("Database is %d sequences behind, i.e. %s",
+                    results['diff']['sequence'],
+                    results['diff']['timestamp']['text']['en'])
+
+        LOG.info("Database's most recent data is %s old", results['local']['age']['text']['en'])

This is the last bit where we disagree. Given that the output is the direct product of the command, it should go directly to stdout and not through the logging subsystem. So my preferred handling would be to leave `LOG.fatal()` in place but replace the `LOG.info()` with `print()`.

-- 
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_r691063755
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20210818/af813acc/attachment-0001.htm>


More information about the Tile-serving mailing list