Added a scan tracker to speed up queries with high offset in very large database

This commit is contained in:
emeric
2024-03-17 23:36:40 +01:00
parent fef4a90ce0
commit ed1be02aaf
9 changed files with 196 additions and 63 deletions
+5 -2
View File
@@ -380,13 +380,16 @@ namespace lms::api::subsonic
}
}
ClientInfo SubsonicResource::getClientInfo(const Wt::Http::ParameterMap& parameters)
ClientInfo SubsonicResource::getClientInfo(const Wt::Http::Request& request)
{
const auto& parameters{ request.getParameterMap() };
ClientInfo res;
if (hasParameter(parameters, "t"))
throw TokenAuthenticationNotSupportedForLDAPUsersError{};
res.ipAddress = request.clientAddress();
// Mandatory parameters
res.name = getMandatoryParameterAs<std::string>(parameters, "c");
res.version = getMandatoryParameterAs<ProtocolVersion>(parameters, "v");
@@ -399,7 +402,7 @@ namespace lms::api::subsonic
RequestContext SubsonicResource::buildRequestContext(const Wt::Http::Request& request)
{
const Wt::Http::ParameterMap& parameters{ request.getParameterMap() };
const ClientInfo clientInfo{ getClientInfo(parameters) };
const ClientInfo clientInfo{ getClientInfo(request) };
const db::UserId userId{ authenticateUser(request, clientInfo) };
bool enableOpenSubsonic{ _openSubsonicDisabledClients.find(clientInfo.name) == std::cend(_openSubsonicDisabledClients) };
bool enableDefaultCover{ _defaultCoverClients.find(clientInfo.name) != std::cend(_openSubsonicDisabledClients) };