From 7e9f3a707aacf5ba98a26b5477b38eed8cc92959 Mon Sep 17 00:00:00 2001 From: Estrella Pan Date: Tue, 27 Jan 2026 07:04:49 +0100 Subject: [PATCH] fix(renamer): only log rename operations that actually succeed Previously, the rename log message was printed before checking if the qBittorrent API call succeeded. This caused log spam when rename operations failed (e.g., due to 409 conflicts or network errors) since the same file would be attempted again on the next cycle. Now the log message is only printed after confirming the rename succeeded, reducing noise in the logs. Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- backend/src/module/downloader/download_client.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/src/module/downloader/download_client.py b/backend/src/module/downloader/download_client.py index 8b2a8e9a..4e4f9034 100644 --- a/backend/src/module/downloader/download_client.py +++ b/backend/src/module/downloader/download_client.py @@ -121,10 +121,14 @@ class DownloadClient(TorrentPath): return await self.client.torrents_files(torrent_hash=torrent_hash) async def rename_torrent_file(self, _hash, old_path, new_path) -> bool: - logger.info(f"{old_path} >> {new_path}") - return await self.client.torrents_rename_file( + result = await self.client.torrents_rename_file( torrent_hash=_hash, old_path=old_path, new_path=new_path ) + if result: + logger.info(f"{old_path} >> {new_path}") + else: + logger.debug(f"[Downloader] Rename failed: {old_path} >> {new_path}") + return result async def delete_torrent(self, hashes, delete_files: bool = True): await self.client.torrents_delete(hashes, delete_files=delete_files)