Prevent re-addition of finished files to queue
This commit is contained in:
parent
fc56013305
commit
b736226140
2 changed files with 22 additions and 3 deletions
|
@ -130,6 +130,9 @@ class ShoreThread(Process):
|
||||||
else:
|
else:
|
||||||
outlist.append(f)
|
outlist.append(f)
|
||||||
|
|
||||||
|
if self.checkFileCompletion(fileobj):
|
||||||
|
self._logger.debug(f"File {fileobj.name} already transferred to all Vessels - not re-adding to queue")
|
||||||
|
else:
|
||||||
self._logger.debug(f"File {fileobj.name} not in processing queue (anymore) - adding")
|
self._logger.debug(f"File {fileobj.name} not in processing queue (anymore) - adding")
|
||||||
outlist.append(fileobj)
|
outlist.append(fileobj)
|
||||||
|
|
||||||
|
@ -138,6 +141,20 @@ class ShoreThread(Process):
|
||||||
for f in outlist:
|
for f in outlist:
|
||||||
self._state["files"].append(f)
|
self._state["files"].append(f)
|
||||||
|
|
||||||
|
def checkFileCompletion(self, fileobj: File) -> bool:
|
||||||
|
db = Database()
|
||||||
|
complete = db.getCompletionByFileUUID(fileobj.uuid)
|
||||||
|
del(db)
|
||||||
|
|
||||||
|
for vessel in self._state["config"].vessels:
|
||||||
|
if vessel.name not in complete and fileobj.directory.name not in vessel._ignoredirs:
|
||||||
|
return False
|
||||||
|
|
||||||
|
if fileobj.exists():
|
||||||
|
fileobj.moveCompleted()
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def processFile(self, directory: Directory, name: str) -> None:
|
def processFile(self, directory: Directory, name: str) -> None:
|
||||||
"""Process a file entry from the observer queue
|
"""Process a file entry from the observer queue
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,8 @@ class VesselThread(Process):
|
||||||
|
|
||||||
self._logger.debug(
|
self._logger.debug(
|
||||||
f"File {fileobj.name} from Directory {fileobj.directory.name} transferred to all Vessels. Moving out of replication directory.")
|
f"File {fileobj.name} from Directory {fileobj.directory.name} transferred to all Vessels. Moving out of replication directory.")
|
||||||
|
|
||||||
|
if fileobj.exists():
|
||||||
fileobj.moveCompleted()
|
fileobj.moveCompleted()
|
||||||
|
|
||||||
def processQueue(self) -> Optional[str]:
|
def processQueue(self) -> Optional[str]:
|
||||||
|
|
Loading…
Reference in a new issue