From ce9d678756447cfe5554d868ace7f1e6fc01a91a Mon Sep 17 00:00:00 2001 From: LZRS <12814349+LZRS@users.noreply.github.com> Date: Tue, 5 Apr 2022 20:02:43 +0300 Subject: [PATCH] sync with using POST request to avoid '414 Request-URI Too Large' --- .../smartregister/chw/application/ChwApplicationFlv.java | 2 +- .../chw/application/ChwSyncConfiguration.java | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java index 0713a68b63..052bb0020f 100644 --- a/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java +++ b/opensrp-chw/src/lmh/java/org/smartregister/chw/application/ChwApplicationFlv.java @@ -9,7 +9,7 @@ public boolean hasANC() { @Override public boolean syncUsingPost() { - return false; + return true; } @Override diff --git a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwSyncConfiguration.java b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwSyncConfiguration.java index 690c4ab97a..96dd4564b5 100644 --- a/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwSyncConfiguration.java +++ b/opensrp-chw/src/main/java/org/smartregister/chw/application/ChwSyncConfiguration.java @@ -11,7 +11,9 @@ import org.smartregister.repository.AllSharedPreferences; import org.smartregister.view.activity.BaseLoginActivity; +import java.util.HashSet; import java.util.List; +import java.util.Set; import static org.smartregister.util.Utils.isEmptyCollection; @@ -36,9 +38,10 @@ public String getSyncFilterValue() { if(StringUtils.isBlank(locationId)) locationId = allSharedPreferences().fetchUserLocalityId(providerId); List locationIds = LocationHelper.getInstance().locationsFromHierarchy(true, null); + if (!isEmptyCollection(locationIds) && locationIds.contains(locationId)) { int index = locationIds.indexOf(locationId); - List subLocationIds = locationIds.subList(index, locationIds.size()); + Set subLocationIds = new HashSet<>(locationIds.subList(index, locationIds.size())); return StringUtils.join(subLocationIds, ","); } return locationId; @@ -115,12 +118,12 @@ public String getOauthClientSecret() { @Override public int getConnectTimeout() { - return BuildConfig.MAX_CONNECTION_TIMEOUT * 60000; + return BuildConfig.MAX_CONNECTION_TIMEOUT * 300000; } @Override public int getReadTimeout() { - return BuildConfig.MAX_READ_TIMEOUT * 60000; + return BuildConfig.MAX_READ_TIMEOUT * 300000; } @Override