mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-01-14 21:54:22 -06:00
Sonarr happiness
This commit is contained in:
@@ -57,7 +57,7 @@ class TrackedFile:
|
|||||||
self.last_mtime = stat.st_mtime
|
self.last_mtime = stat.st_mtime
|
||||||
self.last_size = stat.st_size
|
self.last_size = stat.st_size
|
||||||
return True
|
return True
|
||||||
except (FileNotFoundError, PermissionError, OSError):
|
except (FileNotFoundError, PermissionError):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def is_unchanged(self) -> bool:
|
def is_unchanged(self) -> bool:
|
||||||
@@ -68,7 +68,7 @@ class TrackedFile:
|
|||||||
try:
|
try:
|
||||||
stat = self.path.stat()
|
stat = self.path.stat()
|
||||||
return stat.st_mtime == self.last_mtime and stat.st_size == self.last_size
|
return stat.st_mtime == self.last_mtime and stat.st_size == self.last_size
|
||||||
except (FileNotFoundError, PermissionError, OSError):
|
except (FileNotFoundError, PermissionError):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ class FileStabilityTracker:
|
|||||||
to_remove: list[Path] = []
|
to_remove: list[Path] = []
|
||||||
to_yield: list[Path] = []
|
to_yield: list[Path] = []
|
||||||
|
|
||||||
for path, tracked in list(self._tracked.items()):
|
for path, tracked in self._tracked.items():
|
||||||
time_since_event = current_time - tracked.last_event_time
|
time_since_event = current_time - tracked.last_event_time
|
||||||
|
|
||||||
if time_since_event < self.stability_delay:
|
if time_since_event < self.stability_delay:
|
||||||
@@ -165,7 +165,7 @@ class FileStabilityTracker:
|
|||||||
# Not a regular file (directory, symlink, etc.)
|
# Not a regular file (directory, symlink, etc.)
|
||||||
to_remove.append(path)
|
to_remove.append(path)
|
||||||
logger.debug(f"Path is not a regular file: {path}")
|
logger.debug(f"Path is not a regular file: {path}")
|
||||||
except (PermissionError, OSError) as e:
|
except (PermissionError, FileNotFoundError) as e:
|
||||||
logger.warning(f"Cannot access {path}: {e}")
|
logger.warning(f"Cannot access {path}: {e}")
|
||||||
to_remove.append(path)
|
to_remove.append(path)
|
||||||
|
|
||||||
@@ -342,7 +342,7 @@ def _consume_file(
|
|||||||
if not filepath.is_file():
|
if not filepath.is_file():
|
||||||
logger.debug(f"Not consuming {filepath}: not a file or doesn't exist")
|
logger.debug(f"Not consuming {filepath}: not a file or doesn't exist")
|
||||||
return
|
return
|
||||||
except (PermissionError, OSError) as e:
|
except (PermissionError, FileNotFoundError) as e:
|
||||||
logger.warning(f"Not consuming {filepath}: {e}")
|
logger.warning(f"Not consuming {filepath}: {e}")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user