merge from ray @f5ba0b5b7...

This commit is contained in:
sqlcoder
2009-07-31 21:58:39 +01:00
10 changed files with 65 additions and 106 deletions
+8 -16
View File
@@ -336,23 +336,15 @@ class Importer:
if os.path.exists(file):
stat_info = os.stat(file)
#rulog.writelines("path exists ")
try:
lastupdate = self.updated[file]
#rulog.writelines("lastupdate = %d, mtime = %d" % (lastupdate,stat_info.st_mtime))
if stat_info.st_mtime > lastupdate:
if file in self.updated:
if stat_info.st_size > self.updated[file]:
self.import_file_dict(self.database, file, self.filelist[file][0], self.filelist[file][1])
self.updated[file] = time()
except:
self.updated[file] = time()
# If modified in the last minute run an immediate import.
# This codepath only runs first time the file is found.
self.updated[file] = stat_info.st_size
else:
if os.path.isdir(file) or (time() - stat_info.st_mtime) < 60:
# TODO attach a HHC thread to the file
# TODO import the output of the HHC thread -- this needs to wait for the HHC to block?
self.import_file_dict(self.database, file, self.filelist[file][0], self.filelist[file][1], None)
# TODO we also test if directory, why?
#if os.path.isdir(file):
#self.import_file_dict(self.database, file, self.filelist[file][0], self.filelist[file][1])
self.updated[file] = 0
else:
self.updated[file] = stat_info.st_size
else:
self.removeFromFileList[file] = True
self.addToDirList = filter(lambda x: self.addImportDirectory(x, True, self.addToDirList[x][0], self.addToDirList[x][1]), self.addToDirList)
@@ -421,7 +413,7 @@ class Importer:
last_read_hand = 0
loc = 0
(stored, duplicates, partial, errors, ttime) = (0, 0, 0, 0, 0)
#print "file =", file
# print "file =", file
if file == "stdin":
inputFile = sys.stdin
else: