database commits and user Disconnect
Posted: 20 Feb 2012, 14:27
Hi, I need some advice no best way to update my user data base,
In my system, i use a custome login extension to to auth my client and pull out the saved user profile data from my data base,
e.g joined date, time spent playing, number of games played, games won, games lost, Credit's, ect...
while the user is playing, my extensions are updating my user property object, e.g
PlayerData pd = (PlayerData) user.getProperty(PlayerData.PLAYER_DATA);
pd.incGamesPlayed();
ect....
when the user exits or disconnects I update/commit to the database. this gives me 2 data base updates for ever user, i think this is a good thing ?
When the user in in a room playing a game and then dissconects / crashes out say by closing this broswed,
I want my room disconect extension to update the user.getProperty(PlayerData.PLAYER_DATA); object (in RAM),
and then using the Zone disconect extension to simpley commit the player data object to the data base.
But Smart fox fires the Zone disconect first and then the room disconect second, giving me a problem, how to solve this situation ??
if a user is not in a room and disconects, the zone disconect extension updates the data base nicely and all is ok.
because when a user leaves a room normaly, I update the user.getProperty(PlayerData.PLAYER_DATA); object
In my system, i use a custome login extension to to auth my client and pull out the saved user profile data from my data base,
e.g joined date, time spent playing, number of games played, games won, games lost, Credit's, ect...
while the user is playing, my extensions are updating my user property object, e.g
PlayerData pd = (PlayerData) user.getProperty(PlayerData.PLAYER_DATA);
pd.incGamesPlayed();
ect....
when the user exits or disconnects I update/commit to the database. this gives me 2 data base updates for ever user, i think this is a good thing ?
When the user in in a room playing a game and then dissconects / crashes out say by closing this broswed,
I want my room disconect extension to update the user.getProperty(PlayerData.PLAYER_DATA); object (in RAM),
and then using the Zone disconect extension to simpley commit the player data object to the data base.
But Smart fox fires the Zone disconect first and then the room disconect second, giving me a problem, how to solve this situation ??
if a user is not in a room and disconects, the zone disconect extension updates the data base nicely and all is ok.
because when a user leaves a room normaly, I update the user.getProperty(PlayerData.PLAYER_DATA); object