mirror of
https://github.com/newnius/YAO-scheduler.git
synced 2025-06-07 22:31:55 +00:00
add keep alive support
This commit is contained in:
parent
fda4a7674b
commit
6045e91cca
@ -16,12 +16,18 @@ type ResourcePool struct {
|
|||||||
|
|
||||||
func (pool *ResourcePool) start() {
|
func (pool *ResourcePool) start() {
|
||||||
/* check dead nodes */
|
/* check dead nodes */
|
||||||
pool.heartBeat = map[string]time.Time{}
|
go func() {
|
||||||
for k, v := range pool.heartBeat {
|
pool.heartBeat = map[string]time.Time{}
|
||||||
if v.Add(time.Second * 30).Before(time.Now()) {
|
|
||||||
delete(pool.nodes, k)
|
for {
|
||||||
|
for k, v := range pool.heartBeat {
|
||||||
|
if v.Add(time.Second * 30).Before(time.Now()) {
|
||||||
|
delete(pool.nodes, k)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
time.Sleep(time.Second * 10)
|
||||||
}
|
}
|
||||||
}
|
}()
|
||||||
|
|
||||||
/* save pool status periodically */
|
/* save pool status periodically */
|
||||||
go func() {
|
go func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user