点击立即检查,没有及时更新时间 问题修复
This commit is contained in:
1 parent
f55f4c2961
commit
68bb68b2b4
2 files changed
+26
-1
No files matched your search
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## 启用与兼容
|
## 启用与兼容
|
||||||
|
|
||||||
默认关闭:`USDT_RESOURCE_RENTAL_ENABLED=false`。关闭时保留原转账通道、燃烧预算、审核和账务结算行为,不查询新增资源表。此功能仅用于归集、代付,普通钱包操作不自动购买资源。
|
默认关闭:`USDT_RESOURCE_RENTAL_ENABLED:USDT_RESOURCE_RENTAL_ENABLED=false`。关闭时保留原转账通道、燃烧预算、审核和账务结算行为,不查询新增资源表。此功能仅用于归集、代付,普通钱包操作不自动购买资源。
|
||||||
|
|
||||||
部署前备份数据库,依次执行 `sql/chain_executor.sql`、`sql/resource_rental.sql`。均为增量建表,不删除旧数据。后端与执行器必须共享同一数据库;远程模式还需按 [执行器说明](chain-executor.md) 部署执行器。不要在生产数据库上运行测试脚本。
|
部署前备份数据库,依次执行 `sql/chain_executor.sql`、`sql/resource_rental.sql`。均为增量建表,不删除旧数据。后端与执行器必须共享同一数据库;远程模式还需按 [执行器说明](chain-executor.md) 部署执行器。不要在生产数据库上运行测试脚本。
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ public class ChainExecutorClient {
|
|||||||
private ChainExecutorRuntimeState runtimeState;
|
private ChainExecutorRuntimeState runtimeState;
|
||||||
private RestTemplate http;
|
private RestTemplate http;
|
||||||
private final AtomicBoolean checking = new AtomicBoolean();
|
private final AtomicBoolean checking = new AtomicBoolean();
|
||||||
|
private final Object healthCheckCompletion = new Object();
|
||||||
private volatile boolean reachable;
|
private volatile boolean reachable;
|
||||||
private volatile boolean checked;
|
private volatile boolean checked;
|
||||||
private volatile int consecutiveFailures;
|
private volatile int consecutiveFailures;
|
||||||
@@ -144,12 +145,16 @@ public class ChainExecutorClient {
|
|||||||
log.error("内网链上执行器后台探测异常,后续仍将继续检查,异常类型={}", rootType(failure));
|
log.error("内网链上执行器后台探测异常,后续仍将继续检查,异常类型={}", rootType(failure));
|
||||||
} finally {
|
} finally {
|
||||||
checking.set(false);
|
checking.set(false);
|
||||||
|
synchronized (healthCheckCompletion) {
|
||||||
|
healthCheckCompletion.notifyAll();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 页面状态读取同时触发实时探测,“立即检查”不得只返回进程内旧缓存。 */
|
/** 页面状态读取同时触发实时探测,“立即检查”不得只返回进程内旧缓存。 */
|
||||||
public Map<String, Object> refreshAvailability() {
|
public Map<String, Object> refreshAvailability() {
|
||||||
monitor();
|
monitor();
|
||||||
|
waitForOngoingCheck();
|
||||||
return availability();
|
return availability();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,6 +249,26 @@ public class ChainExecutorClient {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态请求撞上后台探测时等待其完成,避免“立即检查”返回探测前的旧时间。
|
||||||
|
* 最大等待覆盖两次内网HTTP检查的连接与读取超时;中断时保留线程中断标记。
|
||||||
|
*/
|
||||||
|
private void waitForOngoingCheck() {
|
||||||
|
long deadline = System.currentTimeMillis() + 9000L;
|
||||||
|
synchronized (healthCheckCompletion) {
|
||||||
|
while (checking.get()) {
|
||||||
|
long remaining = deadline - System.currentTimeMillis();
|
||||||
|
if (remaining <= 0) return;
|
||||||
|
try {
|
||||||
|
healthCheckCompletion.wait(remaining);
|
||||||
|
} catch (InterruptedException interrupted) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用独立守护线程执行健康检查,不依赖资源租赁模块是否启用Spring全局调度。
|
* 使用独立守护线程执行健康检查,不依赖资源租赁模块是否启用Spring全局调度。
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in new issue
Block a user