From 783528b8b39b5e33ebede8726eccd996af5c6d77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Sat, 30 Sep 2023 15:53:26 +0200 Subject: [PATCH] sorting local images before uploading them --- PiwigoDirectorySync/Services/ImageSynchronizer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PiwigoDirectorySync/Services/ImageSynchronizer.cs b/PiwigoDirectorySync/Services/ImageSynchronizer.cs index 440d802..a6527a8 100644 --- a/PiwigoDirectorySync/Services/ImageSynchronizer.cs +++ b/PiwigoDirectorySync/Services/ImageSynchronizer.cs @@ -184,6 +184,7 @@ internal class ImageSynchronizer : IImageSynchronizer { var imagesToUpload = await _persistenceContext.PiwigoImages.Include(i => i.Album) .Where(i => i.ServerImageId != null && i.Album.ServerId == piwigoServer.Id && i.UploadRequired && i.ServerImageId != null) + .OrderBy(i => i.FilePath) .ToListAsync(ct); _logger.Information("Updating {Count} images", imagesToUpload.Count); @@ -208,6 +209,7 @@ internal class ImageSynchronizer : IImageSynchronizer { var imagesToUpload = await _persistenceContext.PiwigoImages.Include(i => i.Album) .Where(i => i.ServerImageId == null && i.Album.ServerId == piwigoServer.Id && i.Album.ServerAlbumId != null) + .OrderBy(i => i.FilePath) .ToListAsync(ct); _logger.Information("Uploading {Count} images", imagesToUpload.Count); @@ -245,6 +247,7 @@ internal class ImageSynchronizer : IImageSynchronizer { var imagesToSearch = await _persistenceContext.PiwigoImages.Include(i => i.Album) .Where(i => i.ServerImageId == null && i.Album.ServerId == piwigoServer.Id) + .OrderBy(i => i.FilePath) .ToListAsync(ct); _logger.Information("Checking {Count} images if they exist", imagesToSearch.Count);