aboutsummaryrefslogtreecommitdiffstats
path: root/main/src
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2014-11-21 01:21:31 +0100
committerSamuel Tardieu <sam@rfc1149.net>2014-11-21 01:21:31 +0100
commit306c50b701992fd88c1c691ade5c412a0dbaf405 (patch)
treedf72c6d9a3554e9e751a3fcbdf95cc0a2534675d /main/src
parent3e72de6a028edf6a75d60b26bc35023288a2c233 (diff)
downloadcgeo-306c50b701992fd88c1c691ade5c412a0dbaf405.zip
cgeo-306c50b701992fd88c1c691ade5c412a0dbaf405.tar.gz
cgeo-306c50b701992fd88c1c691ade5c412a0dbaf405.tar.bz2
Do not refresh more than 3 caches at the same time
It prevents exhausting the networkScheduler thread pool and reduces the load on servers.
Diffstat (limited to 'main/src')
-rw-r--r--main/src/cgeo/geocaching/CacheListActivity.java2
-rw-r--r--main/src/cgeo/geocaching/utils/RxUtils.java2
2 files changed, 3 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/CacheListActivity.java b/main/src/cgeo/geocaching/CacheListActivity.java
index d1c56b8..d54a6b8 100644
--- a/main/src/cgeo/geocaching/CacheListActivity.java
+++ b/main/src/cgeo/geocaching/CacheListActivity.java
@@ -1207,7 +1207,7 @@ public class CacheListActivity extends AbstractListActivity implements FilteredA
handler.obtainMessage(DownloadProgress.MSG_LOADED, cache).sendToTarget();
subscriber.onCompleted();
}
- }).subscribeOn(RxUtils.networkScheduler);
+ }).subscribeOn(RxUtils.refreshScheduler);
}
}).doOnCompleted(new Action0() {
@Override
diff --git a/main/src/cgeo/geocaching/utils/RxUtils.java b/main/src/cgeo/geocaching/utils/RxUtils.java
index ec8f7b8..72e7630 100644
--- a/main/src/cgeo/geocaching/utils/RxUtils.java
+++ b/main/src/cgeo/geocaching/utils/RxUtils.java
@@ -38,6 +38,8 @@ public class RxUtils {
public static final Scheduler networkScheduler = Schedulers.from(new ThreadPoolExecutor(10, 10, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()));
+ public static final Scheduler refreshScheduler = Schedulers.from(new ThreadPoolExecutor(3, 3, 5, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>()));
+
private static final HandlerThread looperCallbacksThread =
new HandlerThread("Looper callbacks thread", Process.THREAD_PRIORITY_DEFAULT);