Hello, I implemented azure offline sync in my Xamarin.Forms app but I am having performance issues when downloading data. I checked the azure api and everything is responding well. I am downloading approx 5,000 records from various tables. the way I am calling the pullasync is in the following way. The process is taking north of 5 minutes to finish. Is there anything I can do to know what exactly is the problem or is there any way to optimize these calls?
`public async Task SyncAllData(decimal carrierId)
{
//TODO 3: Add connectivity check.
var connected = false;
//Different calls for each platform because isReachable doesnt work with android
if (Device.RuntimePlatform == "Android")
{
connected = CrossConnectivity.Current.IsConnected;
}
else
{
connected = await CrossConnectivity.Current.IsReachable(Helpers.Keys.AzureServiceUrl);
}
if (connected == false)
return;
try
{
//TODO 4: Push and Pull our data
await MobileService.SyncContext.PushAsync();
}
catch (MobileServicePushFailedException ex)
{
//await ResolveConflictsAsync(ex.PushResult.Errors);
Debug.WriteLine("Unable to sync items, that is alright as we have offline capabilities: " + ex);
throw new Exception("An error occured in data sync");
}
PullOptions pullOptions = new PullOptions
{
MaxPageSize = 3000
};
//Sync Draw
try
{
//TODO 4: Push and Pull our data
//await MobileService.SyncContext.PushAsync();
await sCSDrawTable.PullAsync("mySCSDraws" + carrierId, sCSDrawTable.Where(u => u.CarrierID == carrierId),pullOptions);
//MessagingCenter.Send<AzureService>(this, "UpdateSyncDate");
}
catch (MobileServicePushFailedException ex)
{
//await ResolveConflictsAsync(ex.PushResult.Errors);
Debug.WriteLine("Unable to sync items, that is alright as we have offline capabilities: " + ex);
throw new Exception("An error occured in data sync");
}
//Sync Payments
try
{
//TODO 4: Push and Pull our data
//await MobileService.SyncContext.PushAsync();
await paymentTable.PullAsync("allPayments" + carrierId, paymentTable.Where(x => x.CarrierID == carrierId),pullOptions);
//MessagingCenter.Send<AzureService>(this, "UpdateSyncDate");
}
catch (MobileServicePushFailedException ex)
{
//await ResolveConflictsAsync(ex.PushResult.Errors);
Debug.WriteLine("Unable to sync items, that is alright as we have offline capabilities: " + ex);
throw new Exception("An error occured in data sync");
}
//Sync Recurring Transactions
try
{
//TODO 4: Push and Pull our data
//await MobileService.SyncContext.PushAsync();
await recurringTrxnTable.PullAsync("allRecurringTrxn" + carrierId, recurringTrxnTable.Where(x => x.CarrierID == carrierId),pullOptions);
//MessagingCenter.Send<AzureService>(this, "UpdateSyncDate");
}
catch (MobileServicePushFailedException ex)
{
//await ResolveConflictsAsync(ex.PushResult.Errors);
Debug.WriteLine("Unable to sync items, that is alright as we have offline capabilities: " + ex);
throw new Exception("An error occured in data sync");
}
//Sync Tax
try
{
//TODO 4: Push and Pull our data
//await MobileService.SyncContext.PushAsync();
await taxTable.PullAsync("allTaxRecords" + carrierId, taxTable.Where(u => u.CarrierID == carrierId),pullOptions);
//MessagingCenter.Send<AzureService>(this, "UpdateSyncDate");
}
catch (MobileServicePushFailedException ex)
{
//await ResolveConflictsAsync(ex.PushResult.Errors);
Debug.WriteLine("Unable to sync items, that is alright as we have offline capabilities: " + ex);
throw new Exception("An error occured in data sync");
}
MessagingCenter.Send<AzureService>(this, "UpdateSyncDate");
}`