fix: delete peer's parent on PeerEventDownloadSucceeded event (#1085)
When a peer leaves, it calls scheduler's LeaveTask() interface to notify scheduler that it's leaving. And LeaveTask() will re-schedule all its children to find a new parent by calling ScheduleParent(). But some of this peer's children might be in PeerStateSucceeded state, as they have finished downloading tasks from parent. So ScheduleParent() on such children is pointless. Let's delete peer's parent on PeerEventDownloadSucceeded event, so its parent won't call ScheduleParent() on it again, when its parent is leaving. Signed-off-by: Eryu Guan <eguan@linux.alibaba.com>
This commit is contained in:
parent
1c9ffcd938
commit
f56de57c01
|
|
@ -199,6 +199,7 @@ func NewPeer(id string, task *Task, host *Host) *Peer {
|
||||||
p.Task.BackToSourcePeers.Delete(p)
|
p.Task.BackToSourcePeers.Delete(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.DeleteParent()
|
||||||
p.UpdateAt.Store(time.Now())
|
p.UpdateAt.Store(time.Now())
|
||||||
p.Log.Infof("peer state is %s", e.FSM.Current())
|
p.Log.Infof("peer state is %s", e.FSM.Current())
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue