Skip to content

Commit

Permalink
优化批量暂停、继续、删除速度
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie committed Oct 12, 2018
1 parent a1ff1e3 commit b456e16
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public FullHttpResponse uninstallExtension(Channel channel, FullHttpRequest requ
Map<String, Object> data = new HashMap<>();
Map<String, Object> map = getJSONParams(request);
String path = (String) map.get("path");
boolean local = (boolean) map.get("local");
boolean local = map.get("local") != null ? (boolean) map.get("local") : false;
//卸载扩展
ExtensionContent.remove(path, local);
//刷新系统pac代理
Expand Down Expand Up @@ -313,16 +313,14 @@ public FullHttpResponse toggleExtension(Channel channel, FullHttpRequest request
Map<String, Object> map = getJSONParams(request);
String path = (String) map.get("path");
boolean enabled = (boolean) map.get("enabled");
ExtensionContent.get()
ExtensionInfo extensionInfo = ExtensionContent.get()
.stream()
.filter(extensionInfo -> extensionInfo.getMeta().getPath().equals(path))
.filter(e -> e.getMeta().getPath().equals(path))
.findFirst()
.get()
.getMeta()
.setEnabled(enabled)
.save();
.get();
extensionInfo.getMeta().setEnabled(enabled).save();
//刷新pac
ExtensionContent.refresh();
ExtensionContent.refresh(extensionInfo.getMeta().getFullPath(), true);
AppUtil.refreshPAC();
return new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
}
Expand Down

0 comments on commit b456e16

Please sign in to comment.