Skip to content

Commit 7e9f3a7

Browse files
EstrellaXDclaudehappy-otter
committed
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 <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
1 parent 24f1f72 commit 7e9f3a7

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

backend/src/module/downloader/download_client.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,14 @@ async def get_torrent_files(self, torrent_hash: str):
121121
return await self.client.torrents_files(torrent_hash=torrent_hash)
122122

123123
async def rename_torrent_file(self, _hash, old_path, new_path) -> bool:
124-
logger.info(f"{old_path} >> {new_path}")
125-
return await self.client.torrents_rename_file(
124+
result = await self.client.torrents_rename_file(
126125
torrent_hash=_hash, old_path=old_path, new_path=new_path
127126
)
127+
if result:
128+
logger.info(f"{old_path} >> {new_path}")
129+
else:
130+
logger.debug(f"[Downloader] Rename failed: {old_path} >> {new_path}")
131+
return result
128132

129133
async def delete_torrent(self, hashes, delete_files: bool = True):
130134
await self.client.torrents_delete(hashes, delete_files=delete_files)

0 commit comments

Comments
 (0)