From 488dfbbb2f999477b319001b70c4dc8a6218ffe8 Mon Sep 17 00:00:00 2001 From: Newnius Date: Mon, 4 May 2020 00:19:50 +0800 Subject: [PATCH] update --- src/resource_pool.go | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/resource_pool.go b/src/resource_pool.go index 54708e9..787e557 100644 --- a/src/resource_pool.go +++ b/src/resource_pool.go @@ -14,7 +14,7 @@ import ( type ResourcePool struct { poolsCount int - //pools []PoolSeg + pools []PoolSeg poolsMu sync.Mutex history []PoolStatus @@ -83,6 +83,19 @@ func (pool *ResourcePool) start() { go func() { pool.saveStatusHistory() }() + + segID := rand.Intn(pool.poolsCount) + start := &pool.pools[segID] + if start.Nodes == nil { + start = start.Next + } + for cur := start; ; { + log.Info(cur.ID) + cur = cur.Next + if cur.ID == start.ID { + break + } + } } /* check dead nodes periodically */