mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 12:40:07 +00:00
⚡️ improve: 服务监控相关优化
This commit is contained in:
@@ -32,6 +32,7 @@ func DispatchTask(duration time.Duration) {
|
||||
var hasAliveAgent bool
|
||||
dao.DB.Find(&tasks)
|
||||
dao.ServerLock.RLock()
|
||||
startedAt := time.Now()
|
||||
for i := 0; i < len(tasks); i++ {
|
||||
if index >= uint64(len(dao.SortedServerList)) {
|
||||
index = 0
|
||||
@@ -50,6 +51,6 @@ func DispatchTask(duration time.Duration) {
|
||||
index++
|
||||
}
|
||||
dao.ServerLock.RUnlock()
|
||||
time.Sleep(duration)
|
||||
time.Sleep(time.Until(startedAt.Add(duration)))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user