From 5237d5313869b36881d2ec309b181d548198e528 Mon Sep 17 00:00:00 2001 From: Mateusz Konieczny Date: Sat, 6 Jul 2019 22:36:22 +0200 Subject: [PATCH] move to variable from function --- .../streetcomplete/data/OsmModule.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/de/westnordost/streetcomplete/data/OsmModule.java b/app/src/main/java/de/westnordost/streetcomplete/data/OsmModule.java index 223990aea8..760ea69a91 100644 --- a/app/src/main/java/de/westnordost/streetcomplete/data/OsmModule.java +++ b/app/src/main/java/de/westnordost/streetcomplete/data/OsmModule.java @@ -64,18 +64,16 @@ public static OsmConnection osmConnection(OAuthConsumer consumer) return new OsmMapDataFactory(); } - public static int defaultOverpassTimeoutInMiliseconds(){ - // see https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#timeout: - // default value is 180 seconds - // give additional 4 seconds to get and process refusal from Overpass - // or maybe a bit late response rather than trigger timeout exception - return (180 + 4) * 1000; - } + // see https://wiki.openstreetmap.org/wiki/Overpass_API/Overpass_QL#timeout: + // default value is 180 seconds + // give additional 4 seconds to get and process refusal from Overpass + // or maybe a bit late response rather than trigger timeout exception + private static int OVERPASS_QUERY_TIMEOUT_IN_MILISECONDS = (180 + 4) * 1000; @Provides public static OverpassMapDataDao overpassMapDataDao( Provider parserProvider, SharedPreferences prefs) { - Integer timeout = defaultOverpassTimeoutInMiliseconds(); + Integer timeout = OVERPASS_QUERY_TIMEOUT_IN_MILISECONDS; OsmConnection overpassConnection = new OsmConnection( prefs.getString(Prefs.OVERPASS_URL, OVERPASS_API_WITH_ATTIC_DATA_URL), ApplicationConstants.USER_AGENT, null, timeout); return new OverpassMapDataDao(overpassConnection, parserProvider); @@ -84,7 +82,7 @@ public static int defaultOverpassTimeoutInMiliseconds(){ @Provides public static OverpassOldMapDataDao overpassOldMapDataDao( Provider parserProvider, String date) { - Integer timeout = defaultOverpassTimeoutInMiliseconds(); + Integer timeout = OVERPASS_QUERY_TIMEOUT_IN_MILISECONDS; OsmConnection overpassConnection = new OsmConnection( OVERPASS_API_WITH_ATTIC_DATA_URL, ApplicationConstants.USER_AGENT, null, timeout); return new OverpassOldMapDataDao(overpassConnection, parserProvider, date);