now polling backend only: prevent completely read of big files first time (after start of service), initial seek to start time using half-interval search algorithm (see issue #795):

disabled for gamin and pyinotify backends;
pull/716/head
sebres 2014-09-16 17:06:49 +02:00
parent 930678cc0e
commit c1637e97b2
3 changed files with 8 additions and 5 deletions

View File

@ -76,7 +76,7 @@ class FilterGamin(FileFilter):
TODO -- RF: TODO -- RF:
this is a common logic and must be shared/provided by FileFilter this is a common logic and must be shared/provided by FileFilter
""" """
self.getFailures(path, MyTime.time() - self.getFindTime()) self.getFailures(path)
try: try:
while True: while True:
ticket = self.failManager.toBan() ticket = self.failManager.toBan()

View File

@ -55,6 +55,7 @@ class FilterPoll(FileFilter):
## The time of the last modification of the file. ## The time of the last modification of the file.
self.__prevStats = dict() self.__prevStats = dict()
self.__file404Cnt = dict() self.__file404Cnt = dict()
self.__initial = dict()
logSys.debug("Created FilterPoll") logSys.debug("Created FilterPoll")
## ##
@ -83,7 +84,6 @@ class FilterPoll(FileFilter):
# @return True when the thread exits nicely # @return True when the thread exits nicely
def run(self): def run(self):
cntr = 0
while self.active: while self.active:
if logSys.getEffectiveLevel() <= 6: if logSys.getEffectiveLevel() <= 6:
logSys.log(6, "Woke up idle=%s with %d files monitored", logSys.log(6, "Woke up idle=%s with %d files monitored",
@ -93,8 +93,11 @@ class FilterPoll(FileFilter):
for container in self.getLogPath(): for container in self.getLogPath():
filename = container.getFileName() filename = container.getFileName()
if self.isModified(filename): if self.isModified(filename):
self.getFailures(filename, (MyTime.time() - self.getFindTime()) if not cntr else None) # set start time as now - find time for first usage only (prevent performance bug with polling of big files)
cntr += 1 self.getFailures(filename,
(MyTime.time() - self.getFindTime()) if not self.__initial.get(filename) else None
)
self.__initial[filename] = True
self.__modified = True self.__modified = True
if self.__modified: if self.__modified:

View File

@ -102,7 +102,7 @@ class FilterPyinotify(FileFilter):
TODO -- RF: TODO -- RF:
this is a common logic and must be shared/provided by FileFilter this is a common logic and must be shared/provided by FileFilter
""" """
self.getFailures(path, MyTime.time() - self.getFindTime()) self.getFailures(path)
try: try:
while True: while True:
ticket = self.failManager.toBan() ticket = self.failManager.toBan()