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 {
ok := checkWindow(ch, int(interval))
ok := checkWindow(ch, threshold)
if !ok {
log.Warn("chain head has not updated. Restarting systemd service")
aCh <- nil
@ -161,9 +161,9 @@ func checkWindow(ch chan CidWindow, t int) bool {
}
/*
* reads channel of slices of slices of Cids
* compares Cids when len of window is greater or equal to `t` - threshold
* if all slices are the equal, head has not updated and returns false
* get chain head from API
* returns a slice of slices of Cids
* len of slice <= `t` - threshold
*/
func updateWindow(ctx context.Context, a api.FullNode, w CidWindow, t int, ch chan CidWindow) (CidWindow, error) {
head, err := a.ChainHead(ctx)