Cleanup from the Release (#2127)

* Added an FAQ link on the Kavita+ tab.

* Don't query Kavita+ for ratings on comic libraries as there is no upstream provider yet.

* Jumpbar keys are a little hard to click

* Fixed an issue where libraries that don't allow scrobbling could be scrobbled when generating past history with read events.

* Made the min/max release year on metadata filter number and removed the spin arrows for styling.

* Fixed disable tabs color contrast due to bootstrap undocumented change.

* Refactored whole codebase to unify caching mechanism. Upped the default cache memory amount to 75 to account for the extra data load. Still LRU.

Fixed an issue where Cache key was using Port instead.

Refactored all the Configuration code to use strongly typed deserialization.

* Fixed an issue where get latest progress would throw an exception if there was no progress due to LINQ and MAX query.

* Fixed a bug where Send to Device wasn't present on Series cards.

* Hooked up the ability to change the cache size for Kavita via the UI.
This commit is contained in:
Joe Milazzo 2023-07-12 16:06:30 -05:00 committed by GitHub
parent 1ed8889d08
commit 81da9dc444
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
37 changed files with 402 additions and 272 deletions

View file

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using API.Constants;
using API.Data;
using API.DTOs.Jobs;
using API.DTOs.MediaErrors;
@ -13,6 +14,7 @@ using API.Extensions;
using API.Helpers;
using API.Services;
using API.Services.Tasks;
using EasyCaching.Core;
using Hangfire;
using Hangfire.Storage;
using Kavita.Common;
@ -38,12 +40,12 @@ public class ServerController : BaseApiController
private readonly IAccountService _accountService;
private readonly ITaskScheduler _taskScheduler;
private readonly IUnitOfWork _unitOfWork;
private readonly IMemoryCache _memoryCache;
private readonly IEasyCachingProviderFactory _cachingProviderFactory;
public ServerController(ILogger<ServerController> logger,
IBackupService backupService, IArchiveService archiveService, IVersionUpdaterService versionUpdaterService, IStatsService statsService,
ICleanupService cleanupService, IScannerService scannerService, IAccountService accountService,
ITaskScheduler taskScheduler, IUnitOfWork unitOfWork, IMemoryCache memoryCache)
ITaskScheduler taskScheduler, IUnitOfWork unitOfWork, IEasyCachingProviderFactory cachingProviderFactory)
{
_logger = logger;
_backupService = backupService;
@ -55,7 +57,7 @@ public class ServerController : BaseApiController
_accountService = accountService;
_taskScheduler = taskScheduler;
_unitOfWork = unitOfWork;
_memoryCache = memoryCache;
_cachingProviderFactory = cachingProviderFactory;
}
/// <summary>
@ -244,10 +246,16 @@ public class ServerController : BaseApiController
/// <returns></returns>
[Authorize("RequireAdminRole")]
[HttpPost("bust-review-and-rec-cache")]
public ActionResult BustReviewAndRecCache()
public async Task<ActionResult> BustReviewAndRecCache()
{
_memoryCache.Clear();
return Ok();
_logger.LogInformation("Busting Kavita+ Cache");
var provider = _cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.KavitaPlusReviews);
await provider.FlushAsync();
provider = _cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.KavitaPlusRecommendations);
await provider.FlushAsync();
provider = _cachingProviderFactory.GetCachingProvider(EasyCacheProfiles.KavitaPlusRatings);
await provider.FlushAsync();
return Ok();
}