mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
chore: additional logs to troubleshoot issues with synced album (#22285)
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
35b62cd016
commit
fe416b121c
2 changed files with 6 additions and 2 deletions
|
|
@ -4,8 +4,8 @@ import 'package:immich_mobile/infrastructure/repositories/local_album.repository
|
||||||
import 'package:immich_mobile/infrastructure/repositories/remote_album.repository.dart';
|
import 'package:immich_mobile/infrastructure/repositories/remote_album.repository.dart';
|
||||||
import 'package:immich_mobile/providers/infrastructure/album.provider.dart';
|
import 'package:immich_mobile/providers/infrastructure/album.provider.dart';
|
||||||
import 'package:immich_mobile/repositories/drift_album_api_repository.dart';
|
import 'package:immich_mobile/repositories/drift_album_api_repository.dart';
|
||||||
import 'package:logging/logging.dart';
|
|
||||||
import 'package:immich_mobile/utils/debug_print.dart';
|
import 'package:immich_mobile/utils/debug_print.dart';
|
||||||
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
final syncLinkedAlbumServiceProvider = Provider(
|
final syncLinkedAlbumServiceProvider = Provider(
|
||||||
(ref) => SyncLinkedAlbumService(
|
(ref) => SyncLinkedAlbumService(
|
||||||
|
|
@ -31,17 +31,19 @@ class SyncLinkedAlbumService {
|
||||||
selectedAlbums.map((localAlbum) async {
|
selectedAlbums.map((localAlbum) async {
|
||||||
final linkedRemoteAlbumId = localAlbum.linkedRemoteAlbumId;
|
final linkedRemoteAlbumId = localAlbum.linkedRemoteAlbumId;
|
||||||
if (linkedRemoteAlbumId == null) {
|
if (linkedRemoteAlbumId == null) {
|
||||||
|
_log.warning("No linked remote album ID found for local album: ${localAlbum.name}");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final remoteAlbum = await _remoteAlbumRepository.get(linkedRemoteAlbumId);
|
final remoteAlbum = await _remoteAlbumRepository.get(linkedRemoteAlbumId);
|
||||||
if (remoteAlbum == null) {
|
if (remoteAlbum == null) {
|
||||||
|
_log.warning("Linked remote album not found for ID: $linkedRemoteAlbumId");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get assets that are uploaded but not in the remote album
|
// get assets that are uploaded but not in the remote album
|
||||||
final assetIds = await _remoteAlbumRepository.getLinkedAssetIds(userId, localAlbum.id, linkedRemoteAlbumId);
|
final assetIds = await _remoteAlbumRepository.getLinkedAssetIds(userId, localAlbum.id, linkedRemoteAlbumId);
|
||||||
|
_log.fine("Syncing ${assetIds.length} assets to remote album: ${remoteAlbum.name}");
|
||||||
if (assetIds.isNotEmpty) {
|
if (assetIds.isNotEmpty) {
|
||||||
final album = await _albumApiRepository.addAssets(remoteAlbum.id, assetIds);
|
final album = await _albumApiRepository.addAssets(remoteAlbum.id, assetIds);
|
||||||
await _remoteAlbumRepository.addAssets(remoteAlbum.id, album.added);
|
await _remoteAlbumRepository.addAssets(remoteAlbum.id, album.added);
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,12 @@ import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
import 'package:immich_mobile/domain/models/store.model.dart';
|
import 'package:immich_mobile/domain/models/store.model.dart';
|
||||||
import 'package:immich_mobile/domain/services/sync_linked_album.service.dart';
|
import 'package:immich_mobile/domain/services/sync_linked_album.service.dart';
|
||||||
import 'package:immich_mobile/entities/store.entity.dart';
|
import 'package:immich_mobile/entities/store.entity.dart';
|
||||||
|
import 'package:logging/logging.dart';
|
||||||
|
|
||||||
Future<void> syncLinkedAlbumsIsolated(ProviderContainer ref) {
|
Future<void> syncLinkedAlbumsIsolated(ProviderContainer ref) {
|
||||||
final user = Store.tryGet(StoreKey.currentUser);
|
final user = Store.tryGet(StoreKey.currentUser);
|
||||||
if (user == null) {
|
if (user == null) {
|
||||||
|
Logger("SyncLinkedAlbum").warning("No user logged in, skipping linked album sync");
|
||||||
return Future.value();
|
return Future.value();
|
||||||
}
|
}
|
||||||
return ref.read(syncLinkedAlbumServiceProvider).syncLinkedAlbums(user.id);
|
return ref.read(syncLinkedAlbumServiceProvider).syncLinkedAlbums(user.id);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue