mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-24 05:18:58 +00:00
(API, minor) Clean up comments.
This commit is contained in:
parent
e17fcde865
commit
3d54879c14
@ -98,19 +98,16 @@ public class ApiService extends Service {
|
|||||||
|
|
||||||
response.type("application/json");
|
response.type("application/json");
|
||||||
|
|
||||||
|
// Check if we have a cached response
|
||||||
var cachedResponse = responseCache.getResults(license, args[0], request.queryString());
|
var cachedResponse = responseCache.getResults(license, args[0], request.queryString());
|
||||||
if (cachedResponse.isPresent()) {
|
if (cachedResponse.isPresent()) {
|
||||||
wmsa_api_cache_hit_count.labels(license.key).inc();
|
wmsa_api_cache_hit_count.labels(license.key).inc();
|
||||||
return cachedResponse.get();
|
return cachedResponse.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// When no cached response, do the search and cache the result
|
||||||
var result = doSearch(license, args[0], request);
|
var result = doSearch(license, args[0], request);
|
||||||
responseCache.putResults(license, args[0], request.queryString(), result);
|
responseCache.putResults(license, args[0], request.queryString(), result);
|
||||||
|
|
||||||
// We set content type late because in the case of error, we don't want to tell the client
|
|
||||||
// that the error message is JSON when it is plain text.
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user