Hi, Locking won't help you here - consider the situation where user B fetches the list of games, and then user A 'takes' a game - say, half a second later, after user B's call completes, but before his browser finishes displaying it - you'll be left in the same situation.
No matter how you handle things, there's always going to exist the possibility that immediately after you return a result set to user B, another user does something that makes that result set out of date. -Nick Johnson On Tue, Jun 15, 2010 at 3:48 PM, coltsith <[email protected]> wrote: > Hi, I'm writing a simple game server where players can create games > and browse games. I've come across the following dilemma though and > want to see if my solution is a good idea. The dilemma: > > User A calls joinGameAndRemoveItFromList(). > > User B calls fetchAvailableGamesInList() at the same time. > > I'm concerned that User B may fetch the game that User A is joining > and removing from list (since it's no longer available) > > My solution would be to lock the game list while User A is making his > call. That way User B would wait until User A is done with the list. > > However, I realize that this could be very slow. Say there's thousands > of players all wanting to browse the available games (hey it could > happen!) and they shouldn't all have to wait for A to finish, > especially if A is slow for some reason. > > Does anyone have any advice on if this is the right way to go, or if > there's a better solution? > > Thanks! > > -- > You received this message because you are subscribed to the Google Groups > "Google App Engine" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-appengine%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-appengine?hl=en. > > -- Nick Johnson, Developer Programs Engineer, App Engine Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
