Skip to content

Commit

Permalink
Hardcode hartbeat check
Browse files Browse the repository at this point in the history
  • Loading branch information
HannahMarsh committed Nov 4, 2024
1 parent 7718dc4 commit fab49ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ out/
out/*


internal/model/bulletin_board/metrics/prometheus.yml
**/prometheus.yml
21 changes: 11 additions & 10 deletions internal/model/bulletin_board/relayView.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,18 @@ func NewNodeView(n structs.PublicNodeApi, maxTimeBetweenHeartbeats time.Duration
}

func (nv *RelayView) UpdateNode(c structs.PublicNodeApi) {
nv.mu.Lock()
defer nv.mu.Unlock()
if nv.LastHeartbeat.After(c.Time) {
return
} else {
nv.LastHeartbeat = c.Time
}
//nv.mu.Lock()
//defer nv.mu.Unlock()
//if nv.LastHeartbeat.After(c.Time) {
// return
//} else {
// nv.LastHeartbeat = c.Time
//}
}

func (nv *RelayView) IsActive() bool {
nv.mu.RLock()
defer nv.mu.RUnlock()
return time.Since(nv.LastHeartbeat) < nv.MaxTimeBetweenHeartbeats
//nv.mu.RLock()
//defer nv.mu.RUnlock()
//return time.Since(nv.LastHeartbeat) < nv.MaxTimeBetweenHeartbeats
return true
}

0 comments on commit fab49ac

Please sign in to comment.