Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Cache all thumbnails first

vishnukvmdad8f7cbccd44
diff --git a/lib/services/semantic_search/semantic_search_service.dart b/lib/services/semantic_search/semantic_search_service.dart
index 3ceb3ee2a1..ac9a52146e 100644
--- a/lib/services/semantic_search/semantic_search_service.dart
+++ b/lib/services/semantic_search/semantic_search_service.dart
@@ -134,10 +134,24 @@ class SemanticSearchService {
final fileIDs = await _getFileIDsToBeIndexed();
final files = await FilesDB.instance.getUploadedFiles(fileIDs);
_logger.info(files.length.toString() + " to be embedded");
+ await _cacheThumbnails(files);
_queue.addAll(files);
_pollQueue();
}
+ Future<void> _cacheThumbnails(List<EnteFile> files) async {
+ int counter = 0;
+ for (final file in files) {
+ final future1 = getThumbnail(file);
+ final future2 = getThumbnail(file);
+ final future3 = getThumbnail(file);
+ final future4 = getThumbnail(file);
+ await Future.wait([future1, future2, future3, future4]);
+ counter += 4;
+ _logger.info("$counter/${files.length} thumbnails cached");
+ }
+ }
+
Future<List<int>> _getFileIDsToBeIndexed() async {
final uploadedFileIDs = await FilesDB.instance
.getOwnedFileIDs(Configuration.instance.getUserID()!);