From 98441ad08d72f7ff9e791cf744a877c23bd05de6 Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Tue, 20 Feb 2024 17:58:21 +1100 Subject: [PATCH] tidy(bulk_download): do not rely on pagination API to get all images for board We can get all images for the board as a list of image names, then pass that to `_image_handler` to get the DTOs, decoupling from the pagination API. --- .../services/bulk_download/bulk_download_default.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/invokeai/app/services/bulk_download/bulk_download_default.py b/invokeai/app/services/bulk_download/bulk_download_default.py index 6c49957a5c..9fad0c3443 100644 --- a/invokeai/app/services/bulk_download/bulk_download_default.py +++ b/invokeai/app/services/bulk_download/bulk_download_default.py @@ -65,14 +65,8 @@ class BulkDownloadService(BulkDownloadBase): return [self._invoker.services.images.get_dto(image_name) for image_name in image_names] def _board_handler(self, board_id: str) -> list[ImageDTO]: - # -1 is the default value for limit, which means no limit, is_intermediate False only gives us completed images - image_dtos = self._invoker.services.images.get_many( - offset=0, - limit=-1, - board_id=board_id, - is_intermediate=False, - ).items - return image_dtos + image_names = self._invoker.services.board_image_records.get_all_board_image_names_for_board(board_id) + return self._image_handler(image_names) def generate_item_id(self, board_id: Optional[str]) -> str: return uuid_string() if board_id is None else self._get_clean_board_name(board_id) + "_" + uuid_string()