Skip to content

Commit

Permalink
move to variable from function
Browse files Browse the repository at this point in the history
  • Loading branch information
matkoniecz committed Jul 6, 2019
1 parent 575d46a commit 5237d53
Showing 1 changed file with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<OverpassMapDataParser> 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);
Expand All @@ -84,7 +82,7 @@ public static int defaultOverpassTimeoutInMiliseconds(){
@Provides public static OverpassOldMapDataDao overpassOldMapDataDao(
Provider<OverpassMapDataParser> 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);
Expand Down

0 comments on commit 5237d53

Please sign in to comment.