mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix: clear local file cache before upload (#20448)
* clear local file cache before upload * clear cache during hashing * fix test * add button to clear cache manually * add button to clear cache manually --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
d73335ecbc
commit
f416342eff
6 changed files with 30 additions and 0 deletions
|
|
@ -99,6 +99,7 @@ class UploadService {
|
|||
}
|
||||
|
||||
Future<void> manualBackup(List<LocalAsset> localAssets) async {
|
||||
await _storageRepository.clearCache();
|
||||
List<UploadTask> tasks = [];
|
||||
for (final asset in localAssets) {
|
||||
final task = await _getUploadTask(
|
||||
|
|
@ -120,6 +121,8 @@ class UploadService {
|
|||
/// Build the upload tasks
|
||||
/// Enqueue the tasks
|
||||
Future<void> startBackup(String userId, void Function(EnqueueStatus status) onEnqueueTasks) async {
|
||||
await _storageRepository.clearCache();
|
||||
|
||||
shouldAbortQueuingTasks = false;
|
||||
|
||||
final candidates = await _backupRepository.getCandidates(userId);
|
||||
|
|
@ -159,6 +162,7 @@ class UploadService {
|
|||
Future<int> cancelBackup() async {
|
||||
shouldAbortQueuingTasks = true;
|
||||
|
||||
await _storageRepository.clearCache();
|
||||
await _uploadRepository.reset(kBackupGroup);
|
||||
await _uploadRepository.deleteDatabaseRecords(kBackupGroup);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue