refactor: move http api to a new transport layer
This commit is contained in:
parent
476c4b056f
commit
0448f66ab2
41 changed files with 822 additions and 390 deletions
|
|
@ -5,15 +5,14 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"git.wzray.com/homelab/hivemind/internal/app"
|
||||
"git.wzray.com/homelab/hivemind/internal/registry"
|
||||
"git.wzray.com/homelab/hivemind/internal/state"
|
||||
"git.wzray.com/homelab/hivemind/internal/types"
|
||||
"git.wzray.com/homelab/hivemind/internal/web/client"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
type observer struct {
|
||||
state *state.RuntimeState
|
||||
state *app.State
|
||||
interval int
|
||||
backoff int
|
||||
backoffCount int
|
||||
|
|
@ -23,7 +22,7 @@ type observer struct {
|
|||
}
|
||||
|
||||
func newObserver(
|
||||
state *state.RuntimeState,
|
||||
state *app.State,
|
||||
interval int,
|
||||
backoff int,
|
||||
backoffCount int,
|
||||
|
|
@ -63,7 +62,7 @@ func (o *observer) pollNodes(ctx context.Context, onLeave func(types.Node) error
|
|||
delay := time.Duration(o.backoff)
|
||||
alive := false
|
||||
for i := o.backoffCount - 1; i >= 0; i-- {
|
||||
_, err := client.Get[any](n.Endpoint, types.PathNodeHealthcheck)
|
||||
_, err := o.state.Clients.Node.Healthcheck(n.Endpoint)
|
||||
|
||||
if err == nil {
|
||||
logger.Debug().Msg("node is alive")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue