Skip to content

Kavita is a fast, feature rich, cross platform reading server. Built with the goal of being a full solution for all your reading needs. Setup your own server and share your reading collection with your friends and family.

Refactored Cache Cleanup code.

Joseph Milazzoe60f7954107c
diff --git a/API/Controllers/LibraryController.cs b/API/Controllers/LibraryController.cs
index ed193a4d0..19d7465b1 100644
--- a/API/Controllers/LibraryController.cs
+++ b/API/Controllers/LibraryController.cs
@@ -177,13 +177,13 @@ namespace API.Controllers
var username = User.GetUsername();
_logger.LogInformation($"Library {libraryId} is being deleted by {username}.");
var series = await _unitOfWork.SeriesRepository.GetSeriesForLibraryIdAsync(libraryId);
- var volumes = (await _unitOfWork.SeriesRepository.GetVolumesForSeriesAsync(series.Select(x => x.Id).ToArray()))
- .Select(x => x.Id).ToArray();
+ var chapterIds =
+ await _unitOfWork.SeriesRepository.GetChapterIdsForSeriesAsync(series.Select(x => x.Id).ToArray());
var result = await _unitOfWork.LibraryRepository.DeleteLibrary(libraryId);
- if (result && volumes.Any())
+ if (result && chapterIds.Any())
{
- _taskScheduler.CleanupVolumes(volumes);
+ _taskScheduler.CleanupChapters(chapterIds);
}
return Ok(result);
diff --git a/API/Controllers/SeriesController.cs b/API/Controllers/SeriesController.cs
index 7a59a4ae8..0e52fbc61 100644
--- a/API/Controllers/SeriesController.cs
+++ b/API/Controllers/SeriesController.cs
@@ -36,7 +36,6 @@ namespace API.Controllers
public async Task<ActionResult<bool>> DeleteSeries(int seriesId)
{
var username = User.GetUsername();
- //var volumes = (await _unitOfWork.SeriesRepository.GetVolumesForSeriesAsync(new []{seriesId})).Select(x => x.Id).ToArray();
var chapterIds = (await _unitOfWork.SeriesRepository.GetChapterIdsForSeriesAsync(new []{seriesId}));
_logger.LogInformation($"Series {seriesId} is being deleted by {username}.");
var result = await _unitOfWork.SeriesRepository.DeleteSeriesAsync(seriesId);