Merge pull request #1127 from filecoin-project/bug/lotus-health
fixes health agent bug
This commit is contained in:
commit
f9c9316990
@ -111,7 +111,7 @@ var watchHeadCmd = &cli.Command{
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
ok := checkWindow(ch, int(interval))
|
ok := checkWindow(ch, threshold)
|
||||||
if !ok {
|
if !ok {
|
||||||
log.Warn("chain head has not updated. Restarting systemd service")
|
log.Warn("chain head has not updated. Restarting systemd service")
|
||||||
aCh <- nil
|
aCh <- nil
|
||||||
@ -161,9 +161,9 @@ func checkWindow(ch chan CidWindow, t int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* reads channel of slices of slices of Cids
|
* get chain head from API
|
||||||
* compares Cids when len of window is greater or equal to `t` - threshold
|
* returns a slice of slices of Cids
|
||||||
* if all slices are the equal, head has not updated and returns false
|
* len of slice <= `t` - threshold
|
||||||
*/
|
*/
|
||||||
func updateWindow(ctx context.Context, a api.FullNode, w CidWindow, t int, ch chan CidWindow) (CidWindow, error) {
|
func updateWindow(ctx context.Context, a api.FullNode, w CidWindow, t int, ch chan CidWindow) (CidWindow, error) {
|
||||||
head, err := a.ChainHead(ctx)
|
head, err := a.ChainHead(ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user