Commit ca7c9a73 authored by luxq's avatar luxq

update status

parent da2187b2
......@@ -7,6 +7,7 @@ import (
"github.com/odysseus/service-registry/registry"
"github.com/redis/go-redis/v9"
"sort"
"time"
)
type baseService struct {
......@@ -62,6 +63,13 @@ func parseInfo(stype common.ServiceType, res *redis.MapStringStringCmd) ServiceI
if err := res.Scan(&regInfo); err != nil {
return nil
}
if time.Now().UnixMilli()-regInfo.Timestamp > 1000*60*1 {
regInfo.Status = "unhealthy"
}
if time.Now().UnixMilli()-regInfo.Timestamp > 1000*60*10 {
regInfo.Status = "disconnected"
}
return regInfo
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment