反向代理 gRPC 端口(支持 Cloudflare CDN)

This commit is contained in:
Lemoe
2021-11-11 12:49:54 +08:00
parent 57e556eea1
commit 00c712116e
9 changed files with 68 additions and 16 deletions

View File

@@ -57,3 +57,17 @@ func DispatchTask(serviceSentinelDispatchBus <-chan model.Monitor) {
dao.SortedServerLock.RUnlock()
}
}
func DispatchKeepalive() {
dao.Cron.AddFunc("@every 60s", func() {
dao.SortedServerLock.RLock()
defer dao.SortedServerLock.RUnlock()
for i := 0; i < len(dao.SortedServerList); i++ {
if dao.SortedServerList[i] == nil || dao.SortedServerList[i].TaskStream == nil || dao.SortedServerList[i].TaskStream.Context().Err() != nil {
continue
}
dao.SortedServerList[i].TaskStream.Send(&pb.Task{Type: model.TaskTypeKeepalive})
}
})
}