From 65a388419a114e934c044e34cdd07ff4424b9030 Mon Sep 17 00:00:00 2001 From: Dion Date: Fri, 25 Oct 2024 16:47:53 +0200 Subject: [PATCH] change status && add retry for cc error --- .../Services/DatabaseThumbnailGenerationService.cs | 2 +- .../Import/ImportQuery.cs | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/starsky/starsky.feature.thumbnail/Services/DatabaseThumbnailGenerationService.cs b/starsky/starsky.feature.thumbnail/Services/DatabaseThumbnailGenerationService.cs index 172257945f..37e0ff54d1 100644 --- a/starsky/starsky.feature.thumbnail/Services/DatabaseThumbnailGenerationService.cs +++ b/starsky/starsky.feature.thumbnail/Services/DatabaseThumbnailGenerationService.cs @@ -123,7 +123,7 @@ await _updateStatusGeneratedThumbnailService.AddOrUpdateStatusAsync( } var filteredData = resultData - .Where(p => p.Status == FileIndexItem.ExifStatus.Ok).ToList(); + .Where(p => p.Status is FileIndexItem.ExifStatus.Ok or FileIndexItem.ExifStatus.OkAndSame).ToList(); if ( filteredData.Count == 0 ) { diff --git a/starsky/starsky.foundation.database/Import/ImportQuery.cs b/starsky/starsky.foundation.database/Import/ImportQuery.cs index e84fbde502..3461c2f970 100644 --- a/starsky/starsky.foundation.database/Import/ImportQuery.cs +++ b/starsky/starsky.foundation.database/Import/ImportQuery.cs @@ -164,8 +164,17 @@ await RetryHelper.DoAsync(LocalRemoveDefaultQuery, } catch ( DbUpdateConcurrencyException exception ) { - _logger.LogInformation(exception, "[RemoveItemAsync] catch-ed " + - "DbUpdateConcurrencyException (do nothing)"); + _logger.LogInformation("[RemoveItemAsync] catch-ed " + + "DbUpdateConcurrencyException (retry) {exception}", exception.Message); + try + { + await RetryHelper.DoAsync(LocalRemoveDefaultQuery, TimeSpan.FromSeconds(2), 2); + } + catch ( AggregateException ) + { + _logger.LogInformation("[RemoveItemAsync] catch-ed " + + "AggregateException (ignored after retry) {exception}", exception.Message); + } } return importIndexItem;