fix(resource): ReqIpUtil 使用统一 Vertx 单例

原代码在字段级别直接创建 Vertx.vertx() 实例,
可能导致多个 Vertx 实例重复创建,浪费系统资源。

改为使用 WebClientVertxInit.get() 获取统一单例。
This commit is contained in:
yukaidi
2026-05-29 00:31:49 +08:00
parent a83665ac44
commit 1fca578c07

View File

@@ -1,5 +1,6 @@
package cn.qaiu.util;
import cn.qaiu.WebClientVertxInit;
import io.vertx.core.AsyncResult;
import io.vertx.core.MultiMap;
import io.vertx.core.Vertx;
@@ -43,11 +44,11 @@ public class ReqIpUtil {
}
Vertx vertx = Vertx.vertx();
WebClient webClient = WebClient.create(vertx);
// 使用统一的 Vertx 单例,避免重复创建实例
private final Vertx vertx = WebClientVertxInit.get();
private final WebClient webClient = WebClient.create(vertx);
// 发送GET请求
WebClientSession webClientSession = WebClientSession.create(webClient);
private final WebClientSession webClientSession = WebClientSession.create(webClient);
public void exec() {