diff --git a/backend/endpoints/heartbeat.py b/backend/endpoints/heartbeat.py index 76da89319..e67e80309 100644 --- a/backend/endpoints/heartbeat.py +++ b/backend/endpoints/heartbeat.py @@ -29,7 +29,7 @@ from decorators.auth import protected_route from endpoints.responses.heartbeat import HeartbeatResponse from exceptions.fs_exceptions import PlatformAlreadyExistsException from handler.auth.constants import Scope -from handler.database import db_rom_handler, db_user_handler +from handler.database import db_stats_handler, db_user_handler from handler.filesystem import fs_platform_handler from handler.filesystem.base_handler import LibraryStructure from handler.metadata import ( @@ -218,7 +218,7 @@ async def get_setup_library_info(request: Request): # instance can show what RomM already sees on disk. Once the database # holds ROMs that hint is dead weight, and building it walks every # platform directory: tens of seconds on a large library. - if db_rom_handler.has_any_rom(): + if db_stats_handler.get_roms_count() > 0: return { "detected_structure": detected_structure, "existing_platforms": [], diff --git a/backend/handler/database/roms_handler.py b/backend/handler/database/roms_handler.py index 0c1495a5b..353cea176 100644 --- a/backend/handler/database/roms_handler.py +++ b/backend/handler/database/roms_handler.py @@ -1642,19 +1642,6 @@ class DBRomsHandler(DBBaseHandler): or 0 ) - @begin_session - def has_any_rom( - self, - *, - session: Session = None, # type: ignore - ) -> bool: - """Whether the library holds at least one ROM. - - An existence probe rather than a count, for callers that only - need to know whether the library has ever been scanned. - """ - return session.scalar(select(Rom.id).limit(1)) is not None - @begin_session def get_roms_by_fs_name( self,