Hi there.
So, I've been experiencing some lag while sending Storage Service requests to your servers and I'm trying to avoid Application.Quit, Application.Pause, etc. due to unreliability. This means I have to save data after every death in my game which causes considerable lag (about 3-5 seconds).
Here are the functions:
public IEnumerator UpdateAchievements (string DatabaseName, string CollectionName, string Key, string Value, string JSON, System.Action<App42StorageServiceCB> result)
{
//Create new class.
App42StorageServiceCB ASSCB = new App42StorageServiceCB();
//Send new user call.
try
{
Statics.StorageService.UpdateDocumentByKeyValue(DatabaseName, CollectionName, Key, Value, JSON, ASSCB);
}
catch (App42Exception exception)
{
//Debug.Log("Registration exception.");
ASSCB.Error = exception;
ASSCB.Failure = true;
}
//Wait for the process to finish.
while (!ASSCB.Success && !ASSCB.Failure) yield return null;
//Return the result.
result(ASSCB);
Debug.Log("Update achievements.");
}
Then the above function is called with this:
public IEnumerator UpdateAchievementsCR (string Key, string Value, string CollectionName, string JSON, System.Action<App42StorageServiceCB> result)
{
///////////////////////////////////////////////////////////////////////////////////
//This expression gets the user rank.
///////////////////////////////////////////////////////////////////////////////////
App42StorageServiceCB Result = new App42StorageServiceCB();
yield return StartCoroutine(Storage.UpdateAchievements(DatabaseName,
CollectionName,
Key,
Value,
JSON,
value => Result = value));
//if (Result.Success)//Debug.Log("Retrieved achievements.");
//else if (Result.Failure)//Debug.Log(Result.Error);
///////////////////////////////////////////////////////////////////////////////////
result(Result);
}
I've narrowed down the offending function to UpdateDocumentByKeyValue. Is the lag a normal occurrence when sending and retrieving data to the server?
On a side note, InsertJSONDocument causes almost zero lag which makes me think it might be possible to update via DocID, so I'll try that as well.
Thanks in advance for all of your help.