mirror of
https://github.com/chai2010/advanced-go-programming-book.git
synced 2025-05-24 20:52:22 +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)
|
resp, err := remoteRPC(ctx, params)
|
||||||
|
|
||||||
if err != nil {
|
if err == nil {
|
||||||
node.Vote(status.Healthy)
|
node.Vote(status.Healthy)
|
||||||
} else {
|
} else {
|
||||||
node.Vote(status.Unhealthy)
|
node.Vote(status.Unhealthy)
|
||||||
@ -103,9 +103,10 @@ healthcheck := func(endpoint string) {
|
|||||||
resp, err := callRemoteHealthcheckAPI(endpoint)
|
resp, err := callRemoteHealthcheckAPI(endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
dropThisAPINode()
|
dropThisAPINode()
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}
|
||||||
|
|
||||||
for _, endpoint := range endpointList {
|
for _, endpoint := range endpointList {
|
||||||
go healthcheck(endpoint)
|
go healthcheck(endpoint)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user