-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Johan Euphrosine wrote:
> 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()
>
I agree with your analysis of the algorithm. If the tournaments are to
stay longer in the database, DELETE_OLD_TOURNEYS_DELAY must be
increased accordingly.
> 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 :)
It absolutely makes sense. I will fix the server accordingly tomorrow
by replacing

            packet.tourney =
copy.copy(self.tourneys[tourney_serial].__dict__)

with a lookup in the database. This function should not rely on the
in-core data structure describing the tournament. I'll leave out the
prize pool for now.

Cheers


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkiPcL4ACgkQ8dLMyEl6F22wYgCgwRZk7h2lplbAMuw/b1HvPBiq
AlEAn3OduG7+MY7xP1O8odpGILAKPTZM
=xoBo
-----END PGP SIGNATURE-----

begin:vcard
fn:Loic Dachary
n:Dachary;Loic
org:pokersource
adr:;;12 bd Magenta;Paris;;75010;France
email;internet:[EMAIL PROTECTED]
title:Senior Developer
tel;work:+33 9 51 18 43 38
tel;cell:+33 6 64 03 29 07
x-mozilla-html:FALSE
url:http://dachary.org/
version:2.1
end:vcard

_______________________________________________
Pokersource-users mailing list
[email protected]
https://mail.gna.org/listinfo/pokersource-users

Reply via email to