From: Sarah Hoffmann Date: Thu, 4 Feb 2021 15:52:24 +0000 (+0100) Subject: Merge pull request #2161 from lonvia/timeout-for-replication X-Git-Tag: v3.7.0~40 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/82ef02cd1aec4c23b4ebe1c56c6dd2a47c65e0e6?hp=6cc06828dbc722deb1c06dc4176400f727eb24dc Merge pull request #2161 from lonvia/timeout-for-replication Reintroduce timeout for replication file download --- diff --git a/nominatim/cli.py b/nominatim/cli.py index 722022b5..e28ff295 100644 --- a/nominatim/cli.py +++ b/nominatim/cli.py @@ -4,6 +4,7 @@ database administration and querying. """ import datetime as dt import os +import socket import sys import time import argparse @@ -261,11 +262,16 @@ class UpdateReplication: together with --once""") group.add_argument('--osm2pgsql-cache', metavar='SIZE', type=int, help='Size of cache to be used by osm2pgsql (in MB)') + group = parser.add_argument_group('Download parameters') + group.add_argument('--socket-timeout', dest='socket_timeout', type=int, default=60, + help='Set timeout for file downloads.') @staticmethod def _init_replication(args): from .tools import replication, refresh + socket.setdefaulttimeout(args.socket_timeout) + LOG.warning("Initialising replication updates") conn = connect(args.config.get_libpq_dsn()) replication.init_replication(conn, base_url=args.config.REPLICATION_URL)