Skip to content

Commit

Permalink
fix: bypass http cache for import folder files
Browse files Browse the repository at this point in the history
  • Loading branch information
revam committed Apr 23, 2024
1 parent e7ed9de commit f23cbab
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Shokofin/API/ShokoAPIClient.cs
Expand Up @@ -67,6 +67,7 @@ private Task<ReturnType> Get<ReturnType>(string url, string? apiKey = null, bool
private async Task<ReturnType> Get<ReturnType>(string url, HttpMethod method, string? apiKey = null, bool skipCache = false)
{
if (skipCache) {
Logger.LogTrace("Creating object for {Method} {URL}", method, url);
var response = await Get(url, method, apiKey).ConfigureAwait(false);
if (response.StatusCode != HttpStatusCode.OK)
throw ApiException.FromResponse(response);
Expand Down Expand Up @@ -270,10 +271,10 @@ public async Task<IReadOnlyList<File>> GetFilesForSeries(string seriesId)
public async Task<ListResult<File>> GetFilesForImportFolder(int importFolderId, string subPath, int page = 1)
{
if (UseOlderImportFolderFileEndpoints) {
return await Get<ListResult<File>>($"/api/v3/ImportFolder/{importFolderId}/File?page={page}&pageSize=100&includeXRefs=true").ConfigureAwait(false);
return await Get<ListResult<File>>($"/api/v3/ImportFolder/{importFolderId}/File?page={page}&pageSize=100&includeXRefs=true", skipCache: true).ConfigureAwait(false);
}

return await Get<ListResult<File>>($"/api/v3/ImportFolder/{importFolderId}/File?page={page}&folderPath={Uri.EscapeDataString(subPath)}&pageSize=1000&include=XRefs").ConfigureAwait(false);
return await Get<ListResult<File>>($"/api/v3/ImportFolder/{importFolderId}/File?page={page}&folderPath={Uri.EscapeDataString(subPath)}&pageSize=1000&include=XRefs", skipCache: true).ConfigureAwait(false);
}

public async Task<File.UserStats?> GetFileUserStats(string fileId, string? apiKey = null)
Expand Down

0 comments on commit f23cbab

Please sign in to comment.