mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-06-10 23:47:29 +00:00
fix(web-service): ParserApi 中 CacheManager/ServerApi 改为 static 避免每次请求重复创建
CacheManager 和 ServerApi 无请求级状态,每次 new 会造成不必要的对象分配, 改为 static final 字段复用;同时修复 viewURL 中内联 new ServerApi()。
This commit is contained in:
@@ -49,8 +49,8 @@ public class ParserApi {
|
|||||||
return dbService.getStatisticsInfo();
|
return dbService.getStatisticsInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
private final CacheManager cacheManager = new CacheManager();
|
private static final CacheManager cacheManager = new CacheManager();
|
||||||
private final ServerApi serverApi = new ServerApi();
|
private static final ServerApi serverApi = new ServerApi();
|
||||||
|
|
||||||
@RouteMapping(value = "/linkInfo", method = RouteMethod.GET)
|
@RouteMapping(value = "/linkInfo", method = RouteMethod.GET)
|
||||||
public Future<LinkInfoResp> parse(HttpServerRequest request, String pwd, String auth) {
|
public Future<LinkInfoResp> parse(HttpServerRequest request, String pwd, String auth) {
|
||||||
@@ -220,7 +220,7 @@ public class ParserApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String previewURL = SharedDataUtil.getJsonStringForServerConfig("previewURL");
|
String previewURL = SharedDataUtil.getJsonStringForServerConfig("previewURL");
|
||||||
new ServerApi().parseJson(request, pwd, null).onSuccess(res -> {
|
serverApi.parseJson(request, pwd, null).onSuccess(res -> {
|
||||||
redirect(response, previewURL, res);
|
redirect(response, previewURL, res);
|
||||||
}).onFailure(e -> {
|
}).onFailure(e -> {
|
||||||
ResponseUtil.fireJsonResultResponse(response, JsonResult.error(e.toString()));
|
ResponseUtil.fireJsonResultResponse(response, JsonResult.error(e.toString()));
|
||||||
|
|||||||
Reference in New Issue
Block a user