Merge pull request #1127 from filecoin-project/bug/lotus-health

fixes health agent bug
This commit is contained in:
Łukasz Magiera 2020-01-21 03:29:51 +01:00 committed by GitHub
commit f9c9316990
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)