HUD_main: if new hand id int is not available, we can't print it, so that generates a second error, double fault
fpdb_import: ok, we're keeping two lists now, one with updated st_size and one with m_time. grrr.
This commit is contained in:
parent
6e8232f623
commit
6df03cb234
|
@ -163,7 +163,8 @@ class HUD_main(object):
|
||||||
cards['common'] = comm_cards['common']
|
cards['common'] = comm_cards['common']
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
print "db error: skipping ", new_hand_id, err
|
print "db error: skipping ", new_hand_id, err
|
||||||
sys.stderr.write("Database error %s in hand %d. Skipping.\n" % (err, int(new_hand_id)))
|
if new_hand_id: # new_hand_id is none if we had an error prior to the store
|
||||||
|
sys.stderr.write("Database error %s in hand %d. Skipping.\n" % (err, int(new_hand_id)))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if type == "tour": # hand is from a tournament
|
if type == "tour": # hand is from a tournament
|
||||||
|
|
|
@ -68,7 +68,8 @@ class Importer:
|
||||||
self.addToDirList = {}
|
self.addToDirList = {}
|
||||||
self.removeFromFileList = {} # to remove deleted files
|
self.removeFromFileList = {} # to remove deleted files
|
||||||
self.monitor = False
|
self.monitor = False
|
||||||
self.updated = {} #Time last import was run {file:mtime}
|
self.updatedsize = {}
|
||||||
|
self.updatedtime = {}
|
||||||
self.lines = None
|
self.lines = None
|
||||||
self.faobs = None # File as one big string
|
self.faobs = None # File as one big string
|
||||||
self.pos_in_file = {} # dict to remember how far we have read in the file
|
self.pos_in_file = {} # dict to remember how far we have read in the file
|
||||||
|
@ -268,15 +269,18 @@ class Importer:
|
||||||
if os.path.exists(file):
|
if os.path.exists(file):
|
||||||
stat_info = os.stat(file)
|
stat_info = os.stat(file)
|
||||||
#rulog.writelines("path exists ")
|
#rulog.writelines("path exists ")
|
||||||
if file in self.updated:
|
if file in self.updatedsize: # we should be able to assume that if we're in size, we're in time as well
|
||||||
if stat_info.st_size > self.updated[file]:
|
if stat_info.st_size > self.updatedsize[file] or stat_info.st_mtime > self.updatedtime[file]:
|
||||||
self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
|
self.import_file_dict(file, self.filelist[file][0], self.filelist[file][1])
|
||||||
self.updated[file] = stat_info.st_size
|
self.updatedsize[file] = stat_info.st_size
|
||||||
|
self.updatedtime[file] = time()
|
||||||
else:
|
else:
|
||||||
if os.path.isdir(file) or (time() - stat_info.st_mtime) < 60:
|
if os.path.isdir(file) or (time() - stat_info.st_mtime) < 60:
|
||||||
self.updated[file] = 0
|
self.updatedsize[file] = 0
|
||||||
|
self.updatedtime[file] = 0
|
||||||
else:
|
else:
|
||||||
self.updated[file] = stat_info.st_size
|
self.updatedsize[file] = stat_info.st_size
|
||||||
|
self.updatedtime[file] = time()
|
||||||
else:
|
else:
|
||||||
self.removeFromFileList[file] = True
|
self.removeFromFileList[file] = True
|
||||||
self.addToDirList = filter(lambda x: self.addImportDirectory(x, True, self.addToDirList[x][0], self.addToDirList[x][1]), self.addToDirList)
|
self.addToDirList = filter(lambda x: self.addImportDirectory(x, True, self.addToDirList[x][0], self.addToDirList[x][1]), self.addToDirList)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user