Skip to content

High performance self-hosted photo and video management solution.

chore: update drift (#23877)

Alexc086a65fa8b1
diff --git a/mobile/lib/domain/services/background_worker.service.dart b/mobile/lib/domain/services/background_worker.service.dart
index 28c87293f9..8a237f801a 100644
--- a/mobile/lib/domain/services/background_worker.service.dart
+++ b/mobile/lib/domain/services/background_worker.service.dart
@@ -177,6 +177,12 @@ class BackgroundWorkerBgService extends BackgroundWorkerFlutterApi {
}
Future<void> _cleanup() async {
+ await runZonedGuarded(_handleCleanup, (error, stack) {
+ dPrint(() => "Error during background worker cleanup: $error, $stack");
+ });
+ }
+
+ Future<void> _handleCleanup() async {
// If ref is null, it means the service was never initialized properly
if (_isCleanedUp || _ref == null) {
return;
@@ -186,11 +192,16 @@ class BackgroundWorkerBgService extends BackgroundWorkerFlutterApi {
_isCleanedUp = true;
final backgroundSyncManager = _ref?.read(backgroundSyncProvider);
final nativeSyncApi = _ref?.read(nativeSyncApiProvider);
+
+ await _drift.close();
+ await _driftLogger.close();
+
_ref?.dispose();
_ref = null;
_cancellationToken.cancel();
_logger.info("Cleaning up background worker");
+
final cleanupFutures = [
nativeSyncApi?.cancelHashing(),
workerManagerPatch.dispose().catchError((_) async {
@@ -199,8 +210,7 @@ class BackgroundWorkerBgService extends BackgroundWorkerFlutterApi {
}),
LogService.I.dispose(),
Store.dispose(),
- _drift.close(),
- _driftLogger.close(),
+
backgroundSyncManager?.cancel(),
];
diff --git a/mobile/pubspec.lock b/mobile/pubspec.lock
index 59b23f23ca..6a067f509f 100644
--- a/mobile/pubspec.lock
+++ b/mobile/pubspec.lock
@@ -452,10 +452,11 @@ packages:
drift:
dependency: "direct main"
description:
- name: drift
- sha256: "14a61af39d4584faf1d73b5b35e4b758a43008cf4c0fdb0576ec8e7032c0d9a5"
- url: "https://pub.dev"
- source: hosted
+ path: drift
+ ref: "53ef7e9f19fe8f68416251760b4b99fe43f1c575"
+ resolved-ref: "53ef7e9f19fe8f68416251760b4b99fe43f1c575"
+ url: "https://github.com/immich-app/drift"
+ source: git
version: "2.26.0"
drift_dev:
dependency: "direct dev"
diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml
index 3dce49e4e1..187fb88f17 100644
--- a/mobile/pubspec.yaml
+++ b/mobile/pubspec.yaml
@@ -113,6 +113,13 @@ dev_dependencies:
riverpod_generator: ^2.6.1
riverpod_lint: ^2.6.1
+dependency_overrides:
+ drift:
+ git:
+ url: https://github.com/immich-app/drift
+ ref: '53ef7e9f19fe8f68416251760b4b99fe43f1c575'
+ path: drift/
+
flutter:
uses-material-design: true
assets: