mirror of
https://github.com/C9Glax/tranga.git
synced 2025-09-18 07:39:13 +02:00
Sync logging
This commit is contained in:
@@ -24,14 +24,16 @@ public abstract class TrangaBaseContext<T> : DbContext where T : DbContext
|
||||
|
||||
internal async Task<(bool success, string? exceptionMessage)> Sync(CancellationToken token)
|
||||
{
|
||||
Log.Debug($"Syncing {GetType().Name}...");
|
||||
try
|
||||
{
|
||||
await this.SaveChangesAsync(token);
|
||||
int changedRows = await this.SaveChangesAsync(token);
|
||||
Log.Debug($"Synced {changedRows} rows...");
|
||||
return (true, null);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log.Error(null, e);
|
||||
Log.Error("Sync failed:", e);
|
||||
return (false, e.Message);
|
||||
}
|
||||
}
|
||||
|
@@ -24,6 +24,8 @@ public class CleanupMangaconnectorIdsWithoutConnector : BaseWorkerWithContext<Ma
|
||||
}
|
||||
int deletedMangaIds = await DbContext.MangaConnectorToManga.Where(mcId => connectorNames.All(name => name != mcId.MangaConnectorName)).ExecuteDeleteAsync(CancellationToken);
|
||||
Log.Info($"Deleted {deletedMangaIds} mangaIds.");
|
||||
|
||||
await DbContext.SaveChangesAsync(CancellationToken);
|
||||
return [];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user