mirror of
https://github.com/rommapp/romm.git
synced 2026-11-28 17:48:31 +01:00
* perf(scan): download a rom's media files concurrently download_rom_resources fetched the cover, manual, each screenshot, each provider media type and every RetroAchievements badge one after another, so a single ROM never used more than one of the ScreenScraper account's request slots. They now download together. ScreenScraper media still goes through its existing thread and rate limiters, and badges share a new cap of 8 in flight across all scans. The path columns and changed provider media dicts are written back in one update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DAQNWjH7teMsMkFMuUrLTf * style(tests): sort imports with the Trunk isort config Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DAQNWjH7teMsMkFMuUrLTf * fix(scan): code-review fixes for concurrent media downloads - Run provider media dicts one after another, since they share paths - Await every download before raising the first failure (gather_all) - Fetch each duplicate media or badge path once (store_ra_badges) - Reuse store_ra_badges in update_rom - Share the in-flight test helper and trim comments Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DAQNWjH7teMsMkFMuUrLTf * refactor(scan): simplify pass on concurrent media downloads - Move gather_all to utils/concurrency and unpack its results directly - Let write_file_streamed create the badge directory instead of every badge - Share the in-flight test helper through tests/concurrency_stubs - Stub downloads with AsyncMock through one fixture, drop a redundant test Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DAQNWjH7teMsMkFMuUrLTf * fix(scan): save the paths that landed when a provider download fails Cover, manual and screenshot paths are written before a provider media or badge failure is re-raised, so a failure there no longer loses them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DAQNWjH7teMsMkFMuUrLTf * fix(scan): save each download group's results independently Paths, provider media and badges each keep their own outcome, and every change that landed is written before the first failure is re-raised. The test builds a real Rom instead of a namespace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DAQNWjH7teMsMkFMuUrLTf --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
13 lines
402 B
Python
13 lines
402 B
Python
import asyncio
|
|
from collections.abc import Awaitable
|
|
from typing import Any
|
|
|
|
|
|
async def gather_all(*aws: Awaitable[Any]) -> list[Any]:
|
|
"""Await every awaitable, leaving none running, then raise the first failure."""
|
|
results = await asyncio.gather(*aws, return_exceptions=True)
|
|
for result in results:
|
|
if isinstance(result, BaseException):
|
|
raise result
|
|
return results
|