Forum BigDB LoadRange uses different thread?

Discussion and help relating to the PlayerIO database solution, BigDB.

LoadRange uses different thread?

Postby QiX » July 31st, 2010, 3:24 pm

Hi,

I just wanted to confirm and ask for assistance.
i'm loading objects from BigDB using LoadRange function.

the loading takes place on a different functions that supposed to return an array with all the objects the the calling function, and then (for debugging reasons) print the values of the objects.

After running the program I saw that the inner function returns an empty array, and only then starts loading the information using the LoadRange.
are the BigDB functions running on a different thread than the caller functions?
and if it does, is there a way to overcome it?
QiX
QiX
 
Posts: 34
Joined: July 22nd, 2010, 4:41 pm

Re: LoadRange uses different thread?

Postby Benjaminsen » July 31st, 2010, 3:42 pm

First off I am assuming we are talking about the serverside API.

As BigDB requests takes time to execute the API is implemented in such a way that they do not halt execution. The reason for this is simply that a breaking operation would stop all code running in your game while the BigDB request happens and thereby lag all your players.

For player objects you are able to request that the server loads them when a user join. For the remaining methods there is no other way of loading data.

/Chris
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark

Re: LoadRange uses different thread?

Postby QiX » July 31st, 2010, 3:44 pm

in that case, I will just have to load the maps everytime I start the server, and store them in the server as variables.
and refresh them once in a while.

is there a way to control or know when the loading has finished?
QiX
QiX
 
Posts: 34
Joined: July 22nd, 2010, 4:41 pm

Re: LoadRange uses different thread?

Postby Oliver » August 2nd, 2010, 9:57 am

is there a way to control or know when the loading has finished?


The successCallback method will be called when the loading has finished. Example:

Code: Select all
PlayerIO.BigDB.Load("Users", ConnectUserId, delegate (DatabaseObject result){
    if (result != null) {
        //Change a property and save back.
        result.Set("location", "Amsterdam");
        result.Save(null);
    }
});
User avatar
Oliver
.IO
 
Posts: 1159
Joined: January 12th, 2010, 8:29 am


Return to BigDB



cron