Hi,
Looking forward implementing tournament manager support for jpoker,
I noticed that PacketPokerTourneyManager returned by the server is
always empty when the tournament is completed:
[{"length": 3, "tourney_serial": "14", "type": "PacketPokerTourneyManager"}]
I believe this is due to checkTourneysSchedule forgetting about old tournaments:
#
# Forget about old tournaments
#
for tourney in filter(lambda tourney: tourney.state in (
TOURNAMENT_STATE_COMPLETE, TOURNAMENT_STATE_CANCELED ),
self.tourneys.values()):
if now - tourney.finish_time > DELETE_OLD_TOURNEYS_DELAY:
self.deleteTourney(tourney)
And thus deleting service.tourneys entry:
def deleteTourney(self, tourney):
if self.verbose > 2:
self.message("deleteTourney: %d" % tourney.serial)
self.schedule2tourneys[tourney.schedule_serial].remove(tourney)
if len(self.schedule2tourneys[tourney.schedule_serial]) <= 0:
del self.schedule2tourneys[tourney.schedule_serial]
del self.tourneys[tourney.serial]
Entry which is checked before filling PacketPokerTourneyManager:
def tourneyManager(self, tourney_serial):
packet = PacketPokerTourneyManager()
packet.tourney_serial = tourney_serial
if self.tourneys.has_key(tourney_serial):
cursor = self.db.cursor(DictCursor)
cursor.execute("SELECT user_serial, tourney_serial,
table_serial, rank FROM user2tourney WHERE tourney_serial = %d" %
tourney_serial)
packet.user2tourney = cursor.fetchall()
Note that it also occurs when restarting the server because of
service.cleanupTourneys()
Should we get rid of tourneys.has_key(tourney_serial) check ?
(most of the packet data are got from the database anyway)
Or should we consolidate tourneys map in another one (tourneys_done)
before cleaning it ?
Comments or advices are welcome :)
--
bou ^
_______________________________________________
Pokersource-users mailing list
[email protected]
https://mail.gna.org/listinfo/pokersource-users