Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Sync Batch Size Settings to SyncConfiguration #886

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=5.0.6-SNAPSHOT
VERSION_NAME=5.0.7-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Core Application
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,41 @@ public boolean validateUserAssignments() {
return true;
}


/**
* Specifies whether to skip locally saved task marked as {@link org.smartregister.repository.BaseRepository#TYPE_Unsynced}
* when fetching tasks from the server, during sync
*
* @return {@link Boolean}
*/
public boolean skipUnsyncedTasksOnFetchFromServer(){
public boolean skipUnsyncedTasksOnFetchFromServer() {
return false;
}

/**
* Specifies the batch size of clients and events to be pulled from the server in a single request
*
* @return {@link Integer}
*/
public int getSyncPullBatchSize() {
return 250;
}

/**
* Specifies the batch size of clients and events to be pushed to the server in a single request
*
* @return {@link Integer}
*/
public int getSyncPushBatchSize() {
return 50;
}

/**
* Specifies the batch size of clients and event IDs that
* are sent to server for validation in a single request
*
* @return {@link Integer}
*/
public int getSyncValidationBatchSize() {
return 100;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@

public class SyncIntentService extends BaseSyncIntentService {
public static final String SYNC_URL = "/rest/event/sync";
protected static final int EVENT_PULL_LIMIT = 250;
protected static final int EVENT_PUSH_LIMIT = 50;
private static final String ADD_URL = "rest/event/add";
private static final String FAILED_CLIENTS = "failed_clients";
private static final String FAILED_EVENTS = "failed_events";
Expand Down Expand Up @@ -511,7 +509,7 @@ protected void sendSyncProgressBroadcast(int eventCount) {
}

public int getEventPullLimit() {
return EVENT_PULL_LIMIT;
return CoreLibrary.getInstance().getSyncConfiguration().getSyncPullBatchSize();
}

public HTTPAgent getHttpAgent() {
Expand All @@ -533,6 +531,6 @@ protected String getFormattedBaseUrl() {
}

protected Integer getEventBatchSize() {
return EVENT_PUSH_LIMIT;
return CoreLibrary.getInstance().getSyncConfiguration().getSyncPushBatchSize();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class ValidateIntentService extends BaseSyncIntentService {

private Context context;
private HTTPAgent httpAgent;
private static final int FETCH_LIMIT = 100;
private static final String VALIDATE_SYNC_PATH = "rest/validate/sync";
private org.smartregister.Context openSRPContext = CoreLibrary.getInstance().context();

Expand All @@ -54,7 +53,7 @@ protected void onHandleIntent(Intent intent) {

try {
super.onHandleIntent(intent);
int fetchLimit = FETCH_LIMIT;
int fetchLimit = CoreLibrary.getInstance().getSyncConfiguration().getSyncValidationBatchSize();

List<String> clientIds = eventClientRepository.getUnValidatedClientBaseEntityIds(fetchLimit);
if (!clientIds.isEmpty()) {
Expand Down