Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
service-registry
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Odysseus
service-registry
Commits
ca7c9a73
Commit
ca7c9a73
authored
Mar 20, 2024
by
luxq
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update status
parent
da2187b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
baseservice.go
query/baseservice.go
+8
-0
No files found.
query/baseservice.go
View file @
ca7c9a73
...
...
@@ -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
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment