perf(传输): 摆渡目录监听周期 1 分钟改为 5 秒

端到端延迟里有一半是轮询空等:收发两侧各等一次,1 分钟周期下平均空等
60 秒、最坏 120 秒,这是「一页文件也要 2 分钟」的主因,而真正干活不到 2 秒。

改成 5 秒是安全的:空目录一轮只有两次 Files.list + 过滤,开销可忽略;
Spring 的 cron 任务要等上一轮跑完才排下一轮,同一实例内不会重叠。
副作用是损坏包被更频繁重试(失败包当前不删除也不改名,mtime 最老所以
每轮排第一),彻底解决靠方案 5.2 的 .error 改名让位。

部署说明第 10 条原来写「不要改成秒级」,与新默认值矛盾,一并纠正。
This commit is contained in:
KodouWZF
2026-11-03 22:01:25 +08:00
parent 4114c1f434
commit 06fb35b984
6 changed files with 10 additions and 8 deletions

View File

@@ -24,9 +24,10 @@ public class TransferFileMonitorJob {
/**
* 定时扫描传输目录
* 默认每分钟执行一次
* 默认每 5 秒执行一次。cron 任务由 Spring 在上一次执行完成后才排下一次,
* 同一实例内不会重叠;多实例共享同一摆渡目录时需另加认领/互斥机制。
*/
@Scheduled(cron = "${file.transfer.monitor.cron:0 */1 * * * ?}")
@Scheduled(cron = "${file.transfer.monitor.cron:0/5 * * * * ?}")
@AlitaStopWatch
public void execute() {
try {