kopia lustrzana https://github.com/onthegomap/planetiler
wait 5s berfore retrying WikiData request after GOAWAY, configurable with http_retry_wait
rodzic
1b0d5526a7
commit
8377e61e82
|
@ -41,6 +41,7 @@ public record PlanetilerConfig(
|
|||
String httpUserAgent,
|
||||
Duration httpTimeout,
|
||||
int httpRetries,
|
||||
long httpRetryWait,
|
||||
long downloadChunkSizeMB,
|
||||
int downloadThreads,
|
||||
double downloadMaxBandwidth,
|
||||
|
@ -166,6 +167,7 @@ public record PlanetilerConfig(
|
|||
"Planetiler downloader (https://github.com/onthegomap/planetiler)"),
|
||||
arguments.getDuration("http_timeout", "Timeout to use when downloading files over HTTP", "30s"),
|
||||
arguments.getInteger("http_retries", "Retries to use when downloading files over HTTP", 1),
|
||||
arguments.getLong("http_retry_wait", "How long (in milliseconds) to wait before retrying HTTP request", 5_000),
|
||||
arguments.getLong("download_chunk_size_mb", "Size of file chunks to download in parallel in megabytes", 100),
|
||||
arguments.getInteger("download_threads", "Number of parallel threads to use when downloading each file", 1),
|
||||
Parse.bandwidth(arguments.getString("download_max_bandwidth",
|
||||
|
|
|
@ -317,6 +317,14 @@ public class Wikidata {
|
|||
LOGGER.error("sparql query failed, exhausted retries: " + e);
|
||||
throw e;
|
||||
}
|
||||
if (e.getMessage() != null && e.getMessage().contains("GOAWAY")) {
|
||||
try {
|
||||
LOGGER.debug("GOAWAY received, waiting {} ms to give server some room", config.httpRetryWait());
|
||||
Thread.sleep(config.httpRetryWait());
|
||||
} catch (InterruptedException e2) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue