Optimize agent tool async blocking paths

This commit is contained in:
jxxghp
2026-04-28 20:36:49 +08:00
parent c5b716c231
commit 5c1487a9a6
31 changed files with 949 additions and 635 deletions
+5 -1
View File
@@ -950,9 +950,13 @@ class DownloadChain(ChainBase):
torrents = self.list_torrents(downloader=name, status=TorrentStatus.DOWNLOADING)
if not torrents:
return []
history_map = DownloadHistoryOper().get_by_hashes(
[torrent.hash for torrent in torrents if torrent.hash]
)
ret_torrents = []
for torrent in torrents:
history = DownloadHistoryOper().get_by_hash(torrent.hash)
history = history_map.get(torrent.hash)
if history:
# 媒体信息
torrent.media = {