diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/MastodonAPIController.java b/mastodon/src/main/java/org/joinmastodon/android/api/MastodonAPIController.java index ae398cdbf8..d8d8149504 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/MastodonAPIController.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/MastodonAPIController.java @@ -53,9 +53,7 @@ public class MastodonAPIController{ .registerTypeAdapter(Status.class, new Status.StatusDeserializer()) .create(); private static WorkerThread thread=new WorkerThread("MastodonAPIController"); - private static OkHttpClient httpClient=new OkHttpClient.Builder() - .readTimeout(5, TimeUnit.MINUTES) - .build(); + private static OkHttpClient httpClient=new OkHttpClient.Builder().build(); private AccountSession session; private static List badDomains = new ArrayList<>(); diff --git a/mastodon/src/main/java/org/joinmastodon/android/api/MastodonAPIRequest.java b/mastodon/src/main/java/org/joinmastodon/android/api/MastodonAPIRequest.java index 023c28f213..09cb7ca60b 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/api/MastodonAPIRequest.java +++ b/mastodon/src/main/java/org/joinmastodon/android/api/MastodonAPIRequest.java @@ -153,8 +153,9 @@ protected void addHeader(String key, String value){ headers.put(key, value); } - protected void setTimeout(long timeout){ + public MastodonAPIRequest setTimeout(long timeout){ this.timeout=timeout; + return this; } protected String getPathPrefix(){ diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/SearchQueryFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/SearchQueryFragment.java index 84bceb46fc..bd62f4dade 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/SearchQueryFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/discover/SearchQueryFragment.java @@ -140,6 +140,7 @@ public void onSuccess(SearchResults result){ recentsHeader.setVisible(false); } }) + .setTimeout(180000) // 3 minutes (searches can take a long time) .exec(accountID); } }