Skip to content

Commit

Permalink
fix: peer gc (#918)
Browse files Browse the repository at this point in the history
* fix: peer gc

Signed-off-by: Gaius <gaius.qi@gmail.com>

* Check whether the peer is in zombie state

Signed-off-by: sunwp <244372610@qq.com>

Co-authored-by: sunwp <244372610@qq.com>
  • Loading branch information
gaius-qi and 244372610 committed Dec 13, 2021
1 parent 344ed8a commit 869f3d1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scheduler/supervisor/peer.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,13 @@ func (m *peerManager) RunGC() error {

if elapsed > m.peerTTI && !peer.IsDone() && !peer.Host.IsCDN {
if !peer.IsConnected() {
peer.Log().Infof("peer is not connected")
peer.Leave()
}
peer.Log().Infof("peer has been more than %s since last access, it's status changes from %s to zombie", m.peerTTI, peer.GetStatus().String())
peer.SetStatus(PeerStatusZombie)
if peer.GetStatus() != PeerStatusZombie {
peer.Log().Infof("peer has been more than %s since last access, it's status changes from %s to zombie", m.peerTTI, peer.GetStatus().String())
peer.SetStatus(PeerStatusZombie)
}
}

if peer.IsLeave() || peer.IsFail() || elapsed > m.peerTTL {
Expand Down

0 comments on commit 869f3d1

Please sign in to comment.