mirror of
https://github.com/C9Glax/tranga.git
synced 2025-10-11 05:09:49 +02:00
Sync reason System.Reflection.MethodBase.GetCurrentMethod()?.Name
This commit is contained in:
@@ -84,7 +84,7 @@ public class Chapter : Identifiable, IComparable<Chapter>
|
||||
|
||||
//TODO Log here
|
||||
this.Downloaded = File.Exists(chapter.FullArchiveFilePath);
|
||||
await context.Sync(token??CancellationToken.None, GetType());
|
||||
await context.Sync(token??CancellationToken.None, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name);
|
||||
return this.Downloaded;
|
||||
}
|
||||
|
||||
|
@@ -85,7 +85,7 @@ public class MyAnimeList : MetadataFetcher
|
||||
dbManga.Authors.Clear();
|
||||
dbManga.Authors = resultData.Authors.Select(a => new Author(a.Name)).ToList();
|
||||
|
||||
await dbContext.Sync(token, GetType());
|
||||
await dbContext.Sync(token, GetType(), System.Reflection.MethodBase.GetCurrentMethod()?.Name);
|
||||
}
|
||||
|
||||
}
|
@@ -23,10 +23,10 @@ public abstract class TrangaBaseContext<T> : DbContext where T : DbContext
|
||||
}, Array.Empty<string>(), LogLevel.Warning, DbContextLoggerOptions.Level | DbContextLoggerOptions.Category | DbContextLoggerOptions.UtcTime);
|
||||
}
|
||||
|
||||
internal async Task<(bool success, string? exceptionMessage)> Sync(CancellationToken token, Type? trigger = null)
|
||||
internal async Task<(bool success, string? exceptionMessage)> Sync(CancellationToken token, Type? trigger = null, string? reason = null)
|
||||
{
|
||||
int changesCount = ChangeTracker.Entries().Count(e => e.State is not EntityState.Unchanged and not EntityState.Detached);
|
||||
Log.Debug($"Syncing {changesCount} changes {GetType().Name} {trigger?.Name}...");
|
||||
Log.Debug($"Syncing {changesCount} changes {GetType().Name} {trigger?.Name} {reason}...");
|
||||
if (changesCount < 1)
|
||||
return (true, null);
|
||||
try
|
||||
|
Reference in New Issue
Block a user