From f829ed937e2dae90352dff3228620375eac52599 Mon Sep 17 00:00:00 2001 From: Worros Date: Thu, 17 Dec 2009 02:24:57 +0800 Subject: [PATCH] [NEWIMPORT] Move hud call to after database commit HUD still doesn't quite work, but getting closer - suspect hud_cache rebuild isn't happening --- pyfpdb/fpdb_import.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index 3fc35339..7b3dd4f1 100644 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -432,18 +432,21 @@ class Importer: #This code doesn't do anything yet handlist = hhc.getProcessedHands() self.pos_in_file[file] = hhc.getLastCharacterRead() + to_hud = [] for hand in handlist: #try, except duplicates here? hand.prepInsert(self.database) hand.insert(self.database) if self.callHud and hand.dbid_hands != 0: - #print "DEBUG: call to HUD: handsId: %s" % hand.dbid_hands - #pipe the Hands.id out to the HUD - print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_to_hud - self.caller.pipe_to_hud.stdin.write("%s" % (hand.dbid_hands) + os.linesep) + to_hud.append(hand.dbid_hands) self.database.commit() + #pipe the Hands.id out to the HUD + for hid in to_hud: + print "fpdb_import: sending hand to hud", hand.dbid_hands, "pipe =", self.caller.pipe_to_hud + self.caller.pipe_to_hud.stdin.write("%s" % (hid) + os.linesep) + errors = getattr(hhc, 'numErrors') stored = getattr(hhc, 'numHands') else: