mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 12:32:21 +00:00
Update ch5-10-service-discovery.md
还没写完呢?
This commit is contained in:
parent
d09ec610ce
commit
c7fa763ad3
@ -84,7 +84,7 @@ node := getNodeFromPool()
|
||||
|
||||
resp, err := remoteRPC(ctx, params)
|
||||
|
||||
if err != nil {
|
||||
if err == nil {
|
||||
node.Vote(status.Healthy)
|
||||
} else {
|
||||
node.Vote(status.Unhealthy)
|
||||
@ -103,9 +103,10 @@ healthcheck := func(endpoint string) {
|
||||
resp, err := callRemoteHealthcheckAPI(endpoint)
|
||||
if err != nil {
|
||||
dropThisAPINode()
|
||||
break
|
||||
}
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
for _, endpoint := range endpointList {
|
||||
go healthcheck(endpoint)
|
||||
|
Loading…
x
Reference in New Issue
Block a user