Fix dead file cleaner false positives from transfer path resolution failure
Use config_manager for transfer path (same source as playback) instead of separate DB read that silently falls back to ./Transfer under contention. Abort scan if transfer folder doesn't exist to prevent mass false findings.
This commit is contained in:
parent
cc62541a65
commit
0a5a874c08
2 changed files with 18 additions and 2 deletions
|
|
@ -56,6 +56,19 @@ class DeadFileCleanerJob(RepairJob):
|
||||||
def scan(self, context: JobContext) -> JobResult:
|
def scan(self, context: JobContext) -> JobResult:
|
||||||
result = JobResult()
|
result = JobResult()
|
||||||
|
|
||||||
|
# Safety: abort if transfer folder doesn't exist — prevents mass false positives
|
||||||
|
if not context.transfer_folder or not os.path.isdir(context.transfer_folder):
|
||||||
|
logger.error("Transfer folder not found: %s — aborting dead file scan to avoid false positives",
|
||||||
|
context.transfer_folder)
|
||||||
|
result.errors += 1
|
||||||
|
if context.report_progress:
|
||||||
|
context.report_progress(
|
||||||
|
phase='Aborted — transfer folder not found',
|
||||||
|
log_line=f'Transfer folder does not exist: {context.transfer_folder}',
|
||||||
|
log_type='error'
|
||||||
|
)
|
||||||
|
return result
|
||||||
|
|
||||||
# Fetch all tracks with file paths, joining to get artist/album names
|
# Fetch all tracks with file paths, joining to get artist/album names
|
||||||
tracks = []
|
tracks = []
|
||||||
conn = None
|
conn = None
|
||||||
|
|
|
||||||
|
|
@ -500,8 +500,11 @@ class RepairWorker:
|
||||||
self._current_job_name = job.display_name
|
self._current_job_name = job.display_name
|
||||||
self._current_progress = {'scanned': 0, 'total': 0, 'percent': 0}
|
self._current_progress = {'scanned': 0, 'total': 0, 'percent': 0}
|
||||||
|
|
||||||
# Re-read transfer path
|
# Re-read transfer path — prefer config_manager (same source as web_server)
|
||||||
raw = self._get_transfer_path_from_db()
|
if self._config_manager:
|
||||||
|
raw = self._config_manager.get('soulseek.transfer_path', './Transfer')
|
||||||
|
else:
|
||||||
|
raw = self._get_transfer_path_from_db()
|
||||||
self.transfer_folder = self._resolve_path(raw)
|
self.transfer_folder = self._resolve_path(raw)
|
||||||
|
|
||||||
# Notify rich progress system
|
# Notify rich progress system
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue