π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Delete index file on load error
laurenspriem4098c1a0722d
diff --git a/mobile/apps/photos/lib/db/ml/clip_vector_db.dart b/mobile/apps/photos/lib/db/ml/clip_vector_db.dartindex 29d24b324e..0ac9b4929a 100644--- a/mobile/apps/photos/lib/db/ml/clip_vector_db.dart+++ b/mobile/apps/photos/lib/db/ml/clip_vector_db.dart@@ -39,10 +39,26 @@ class ClipVectorDB {final documentsDirectory = await getApplicationDocumentsDirectory();final String dbPath = join(documentsDirectory.path, _databaseName);_logger.info("Opening vectorDB access: DB path " + dbPath);- final vectorDB = VectorDb(- filePath: dbPath,- dimensions: _embeddingDimension,- );+ late VectorDb vectorDB;+ try {+ vectorDB = VectorDb(+ filePath: dbPath,+ dimensions: _embeddingDimension,+ );+ } catch (e, s) {+ _logger.severe("Could not open VectorDB at path $dbPath", e, s);+ _logger.severe("Deleting the index file and trying again");+ await deleteIndexFile();+ try {+ vectorDB = VectorDb(+ filePath: dbPath,+ dimensions: _embeddingDimension,+ );+ } catch (e, s) {+ _logger.severe("Still can't open VectorDB at path $dbPath", e, s);+ rethrow;+ }+ }final stats = await getIndexStats(vectorDB);_logger.info("VectorDB connection opened with stats: ${stats.toString()}");