mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-05-24 00:52:23 -04:00
When the DB fails to save, log out all the series the user should look into for constraint issues and push a message to the admins connected to webui. (#687)
This commit is contained in:
parent
8b03e1d240
commit
6adf092668
@ -301,7 +301,21 @@ namespace API.Services.Tasks
|
||||
UpdateSeries(series, parsedSeries);
|
||||
});
|
||||
|
||||
await _unitOfWork.CommitAsync();
|
||||
try
|
||||
{
|
||||
await _unitOfWork.CommitAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.LogCritical(ex, "[ScannerService] There was an issue writing to the DB. Chunk {ChunkNumber} did not save to DB. If debug mode, series to check will be printed", chunk);
|
||||
foreach (var series in nonLibrarySeries)
|
||||
{
|
||||
_logger.LogDebug("[ScannerService] There may be a constraint issue with {SeriesName}", series.OriginalName);
|
||||
}
|
||||
await _messageHub.Clients.All.SendAsync(SignalREvents.ScanLibraryError,
|
||||
MessageFactory.ScanLibraryError(library.Id));
|
||||
continue;
|
||||
}
|
||||
_logger.LogInformation(
|
||||
"[ScannerService] Processed {SeriesStart} - {SeriesEnd} series in {ElapsedScanTime} milliseconds for {LibraryName}",
|
||||
chunk * chunkInfo.ChunkSize, (chunk * chunkInfo.ChunkSize) + nonLibrarySeries.Count, totalTime, library.Name);
|
||||
|
@ -96,5 +96,17 @@ namespace API.SignalR
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static SignalRMessage ScanLibraryError(int libraryId)
|
||||
{
|
||||
return new SignalRMessage
|
||||
{
|
||||
Name = SignalREvents.ScanLibraryError,
|
||||
Body = new
|
||||
{
|
||||
LibraryId = libraryId,
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,5 +11,6 @@
|
||||
public const string ScanLibraryProgress = "ScanLibraryProgress";
|
||||
public const string OnlineUsers = "OnlineUsers";
|
||||
public const string SeriesAddedToCollection = "SeriesAddedToCollection";
|
||||
public const string ScanLibraryError = "ScanLibraryError";
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,8 @@ export enum EVENTS {
|
||||
SeriesAdded = 'SeriesAdded',
|
||||
ScanLibraryProgress = 'ScanLibraryProgress',
|
||||
OnlineUsers = 'OnlineUsers',
|
||||
SeriesAddedToCollection = 'SeriesAddedToCollection'
|
||||
SeriesAddedToCollection = 'SeriesAddedToCollection',
|
||||
ScanLibraryError = 'ScanLibraryError'
|
||||
}
|
||||
|
||||
export interface Message<T> {
|
||||
@ -93,6 +94,16 @@ export class MessageHubService {
|
||||
});
|
||||
});
|
||||
|
||||
this.hubConnection.on(EVENTS.ScanLibraryError, resp => {
|
||||
this.messagesSource.next({
|
||||
event: EVENTS.ScanLibraryError,
|
||||
payload: resp.body
|
||||
});
|
||||
if (this.isAdmin) {
|
||||
this.toastr.error('Library Scan had a critical error. Some series were not saved. Check logs');
|
||||
}
|
||||
});
|
||||
|
||||
this.hubConnection.on(EVENTS.SeriesAdded, resp => {
|
||||
this.messagesSource.next({
|
||||
event: EVENTS.SeriesAdded,
|
||||
|
Loading…
x
Reference in New Issue
Block a user