Skip to content

Commit f306da1

Browse files
committed
fix: 加了点料
1 parent 9fa3f51 commit f306da1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

core/cluster.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ def __init__(self, clusters: 'ClusterManager'):
254254
self.cluster_last_modified: defaultdict['Cluster', int] = defaultdict(lambda: 0)
255255
self.sync_sem: utils.SemaphoreLock = utils.SemaphoreLock(256)
256256
self.download_statistics = DownloadStatistics()
257+
self.failed_hash: defaultdict[str, int] = defaultdict(lambda: 0)
257258

258259
async def _get_filelist(self, cluster: 'Cluster'):
259260
async with aiohttp.ClientSession(
@@ -322,7 +323,7 @@ async def download(self, filelist: set[File]):
322323
file_queues = asyncio.Queue()
323324
for file in filelist:
324325
await file_queues.put(file)
325-
sessions = []
326+
sessions: list[aiohttp.ClientSession] = []
326327
tasks = []
327328
with DownloadStatistics(
328329
total=total,
@@ -345,8 +346,7 @@ async def download(self, filelist: set[File]):
345346
finally:
346347
for session in sessions:
347348
await session.close()
348-
349-
349+
self.failed_hash.clear()
350350

351351
async def _download(self, session: aiohttp.ClientSession, file_queues: asyncio.Queue[File], pbar: DownloadStatistics):
352352
while not file_queues.empty():
@@ -417,7 +417,6 @@ def report(self, file: File, error: Exception, resp: Optional[aiohttp.ClientResp
417417
logger.debug(error)
418418
logger.terror(f"clusters.error.downloading", type=type, file_hash=file.hash, file_size=units.format_bytes(file.size), host=host, file_path=file.path, hash=hash, responses="\n".join(("", *responses)))
419419

420-
421420
async def _get_configuration(self, cluster: 'Cluster'):
422421
async with aiohttp.ClientSession(
423422
config.const.base_url,

0 commit comments

Comments
 (0)