Reducing Lag When Making Storage Service Calls

0 votes
Version : 4.1.2

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.

 

asked Jul 14 in Android by null (23 points)
Update:

UpdateDocumentByDocId didn't improve performance.
Update:

InsertJSONDocument does actually cause lag.

1 Answer

0 votes
Hi,

Could you please share the JSON you ae trying to insert and getting 3-5 seconds of lag? You can share it at support@shephertz.com .

It will help us to understand the problem.

Thanks.
answered Jul 17 by rajeev.etc (1,498 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
Migrate from Parse to ShepHertz App42
...