Forum BigDB Help with saving online status with bigDB

Discussion and help relating to Player.IO's database solution, BigDB.

Help with saving online status with bigDB

Postby wbsaputra » November 5th, 2011, 1:43 am

I use online status with BigDB object and save at userleft method.
Any advice how to make sure bigdb save running while userleft and room close?

i keep getting this error
Error clearing online status PlayerIO.GameLibrary.PlayerIOError: The database object XXXX could not be saved using optimistic locks as it's out of date.

yeap i use optimistick lock, is this cause a problem?
Any idea?
wbsaputra
Paid Member
 
Posts: 116
Joined: June 29th, 2010, 4:38 pm

Re: Help with saving online status with bigDB

Postby Oliver » November 7th, 2011, 3:47 pm

Optimistic locks will fail if you have a lot of writes going into the same object at the same time.

Are you trying to save online status for all users in a single database object?

- Oliver
User avatar
Oliver
.IO
 
Posts: 1136
Joined: January 12th, 2010, 8:29 am

Re: Help with saving online status with bigDB

Postby wbsaputra » November 8th, 2011, 2:55 am

No i use player object for each user to save their online status.
i've remove optimistic locking now, seems working fine, but sometimes there are limit to save player object at sametime like this "Could not grab object because to many save bla2...".
Is there anyway to resolve this?
wbsaputra
Paid Member
 
Posts: 116
Joined: June 29th, 2010, 4:38 pm

Re: Help with saving online status with bigDB

Postby Oliver » November 8th, 2011, 10:10 am

Stop doing so many saves at the same time. There's a limit to concurrent writes to the same object in bigdb.

- Oliver
User avatar
Oliver
.IO
 
Posts: 1136
Joined: January 12th, 2010, 8:29 am

Re: Help with saving online status with bigDB

Postby wbsaputra » November 8th, 2011, 11:15 am

Oliver wrote:Stop doing so many saves at the same time. There's a limit to concurrent writes to the same object in bigdb.

- Oliver


Okay, but how about player leaving room at the same time? I should save their online status to each player object right?
Or how if more than 5 player disconnect at the same time or suddenly room closed, their online status is stuck if cause there is a limit to save object.
wbsaputra
Paid Member
 
Posts: 116
Joined: June 29th, 2010, 4:38 pm

Re: Help with saving online status with bigDB

Postby Oliver » November 8th, 2011, 11:20 am

It's is a limit per object.

You can have many saves going on concurrently to different objects if you want.

You can even have concurrent saves going on to the same object, but it has to be less than the limit.

The only reason it would fail to call PlayerObject.Save() in UserLeft() is if you already had too many saves going on at the time.

- Oliver
User avatar
Oliver
.IO
 
Posts: 1136
Joined: January 12th, 2010, 8:29 am

Re: Help with saving online status with bigDB

Postby wbsaputra » November 8th, 2011, 1:29 pm

I use this method

result.Set("Online.RoomId", myroom.RKey);
result.Set("Online.RoomRegion", myroom.Region);
result.Set("Online.RoomType", myroom.Type);
result.Set("Online.RoomCode", myroom.Code);
result.Set("Online.Firstname", ply.firstname);
result.Set("Online.Init", true);

You mean "Online" is one object?
wbsaputra
Paid Member
 
Posts: 116
Joined: June 29th, 2010, 4:38 pm

Re: Help with saving online status with bigDB

Postby Oliver » November 8th, 2011, 1:47 pm

no, result is.
User avatar
Oliver
.IO
 
Posts: 1136
Joined: January 12th, 2010, 8:29 am

Re: Help with saving online status with bigDB

Postby wbsaputra » November 8th, 2011, 2:20 pm

how many is limit save per one object?
wbsaputra
Paid Member
 
Posts: 116
Joined: June 29th, 2010, 4:38 pm

Re: Help with saving online status with bigDB

Postby Oliver » November 8th, 2011, 6:58 pm

i think it's 5
User avatar
Oliver
.IO
 
Posts: 1136
Joined: January 12th, 2010, 8:29 am

Re: Help with saving online status with bigDB

Postby wbsaputra » November 9th, 2011, 2:12 am

ok, i try change mo code,
btw can i get server time at client side before user joining room with as3?
I need calculate time different between current server time and last time user login to give user daily bonus etc.
wbsaputra
Paid Member
 
Posts: 116
Joined: June 29th, 2010, 4:38 pm

Re: Help with saving online status with bigDB

Postby Oliver » November 9th, 2011, 10:52 am

You can't get the time on a server without connecting to a server... :-)
User avatar
Oliver
.IO
 
Posts: 1136
Joined: January 12th, 2010, 8:29 am


Return to BigDB