makes log output during scan less verbose
All checks were successful
PiwigoDirectorySync/pipeline/head This commit looks good

This commit is contained in:
Philipp Häfelfinger 2023-09-30 15:11:06 +02:00
parent b910987a24
commit 72e88319f3

View File

@ -117,8 +117,6 @@ internal class FileIndexer : IFileIndexer
await using var tx = await db.Database.BeginTransactionAsync(IsolationLevel.Serializable, ct);
var piwigoServer = await db.PiwigoServers.GetByIdAsync(serverId, ct);
_logger.Information("Get or crate album for directory {AlbumDirectory}", directory);
var albumId = await GetOrAddAlbumAsync(db, serverId, piwigoServer.RootDirectory, directory, ct);
await tx.CommitAsync(ct);
@ -126,15 +124,17 @@ internal class FileIndexer : IFileIndexer
});
}
private static async Task<int> GetOrAddAlbumAsync(PersistenceContext db, int serverId, string rootDirectory, DirectoryInfo directory, CancellationToken ct)
private async Task<int> GetOrAddAlbumAsync(PersistenceContext db, int serverId, string rootDirectory, DirectoryInfo directory, CancellationToken ct)
{
var albumPath = Path.GetRelativePath(rootDirectory, directory.FullName);
var album = await db.PiwigoAlbums.FindByServerAndPathAsync(serverId, albumPath, ct);
if (album != null)
{
_logger.Debug("Found album with id {AlbumId} for directory {AlbumDirectory}", album.Id, directory);
return album.Id;
}
_logger.Information("creating album for directory {AlbumDirectory}", directory);
int? parentAlbumId = null;
if (!string.Equals(new DirectoryInfo(rootDirectory).FullName, directory.Parent!.FullName))
{