mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-06-10 23:47:29 +00:00
fix(core): ConfigRetriever 成功路径也调用 close() 防止资源泄漏
readConfig() 中 onSuccess 回调未关闭 ConfigRetriever, 文件监听器和底层资源无法释放,现在成功和失败路径均调用 close()。
This commit is contained in:
@@ -62,7 +62,10 @@ public class ConfigUtil {
|
|||||||
// 异步获取配置
|
// 异步获取配置
|
||||||
// 成功直接完成 promise
|
// 成功直接完成 promise
|
||||||
retriever.getConfig()
|
retriever.getConfig()
|
||||||
.onSuccess(promise::complete)
|
.onSuccess(config -> {
|
||||||
|
promise.complete(config);
|
||||||
|
retriever.close();
|
||||||
|
})
|
||||||
.onFailure(err -> {
|
.onFailure(err -> {
|
||||||
// 配置读取失败,直接返回失败 Future
|
// 配置读取失败,直接返回失败 Future
|
||||||
promise.fail(new RuntimeException(
|
promise.fail(new RuntimeException(
|
||||||
|
|||||||
Reference in New Issue
Block a user