复查修复(三): 调度与扫描

- scan: .tmp/.part 过滤 + list_files 分批遍历(消除 10 万条截断误判)
- Scheduler: 持锁只做标记, 锁外异步执行任务(长任务不再冻结调度)
- cron 范围/步进边界校验;FTP 下载后大小校验防静默截断
This commit is contained in:
HYC Fixer
2026-09-02 00:40:09 +08:00
parent 82875b710a
commit ccd66b806f
3 changed files with 533 additions and 502 deletions
+6
View File
@@ -1307,6 +1307,12 @@ class MirrorSyncManager:
ftp.retrbinary(f'RETR {remote_filename}', f.write, rest=start_pos)
else:
ftp.retrbinary(f'RETR {remote_filename}', f.write)
# 校验下载大小与远端一致,防止静默截断
actual_size = os.path.getsize(local_path)
expected = file_info.get('size')
if expected is not None and expected > 0 and actual_size != expected:
raise Exception(f"文件大小不匹配: {actual_size} != {expected}")
return True
except Exception as e: