mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
Merge pull request #309 from misaochan/master
Add maximum timeout to await()
This commit is contained in:
commit
ac22b147e5
1 changed files with 3 additions and 2 deletions
|
|
@ -47,6 +47,7 @@ import java.util.Set;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import fr.free.nrw.commons.CommonsApplication;
|
import fr.free.nrw.commons.CommonsApplication;
|
||||||
import fr.free.nrw.commons.R;
|
import fr.free.nrw.commons.R;
|
||||||
|
|
@ -151,7 +152,7 @@ public class CategorizationFragment extends Fragment {
|
||||||
|
|
||||||
//Only return titleCatItems after API call has finished
|
//Only return titleCatItems after API call has finished
|
||||||
try {
|
try {
|
||||||
mergeLatch.await();
|
mergeLatch.await(5L, TimeUnit.SECONDS);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Log.e(TAG, "Interrupted exception: ", e);
|
Log.e(TAG, "Interrupted exception: ", e);
|
||||||
}
|
}
|
||||||
|
|
@ -204,7 +205,7 @@ public class CategorizationFragment extends Fragment {
|
||||||
|
|
||||||
//Await results of titleItems, which is likely to come in last
|
//Await results of titleItems, which is likely to come in last
|
||||||
try {
|
try {
|
||||||
mergeLatch.await();
|
mergeLatch.await(5L, TimeUnit.SECONDS);
|
||||||
Log.d(TAG, "Waited for merge");
|
Log.d(TAG, "Waited for merge");
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
Log.e(TAG, "Interrupted Exception: ", e);
|
Log.e(TAG, "Interrupted Exception: ", e);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue