Skip to content

Commit

Permalink
feat: add cdn task peers monitor log (#764)
Browse files Browse the repository at this point in the history
Signed-off-by: santong <[email protected]>
  • Loading branch information
244372610 committed Oct 28, 2021
1 parent aaf769e commit 51b36b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion scheduler/core/scheduler/basic/basic_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (s *Scheduler) ScheduleParent(peer *supervisor.Peer, blankParents sets.Stri

func (s *Scheduler) selectCandidateChildren(peer *supervisor.Peer, limit int, blankChildren sets.String) (candidateChildren []*supervisor.Peer) {
peer.Log().Debug("start schedule children flow")
defer peer.Log().Debugf("finish schedule parent flow, select num %d candidate children, "+
defer peer.Log().Debugf("finish schedule children flow, select num %d candidate children, "+
"current task tree node count %d, back source peers: %v", len(candidateChildren), peer.Task.GetPeers().Size(), peer.Task.GetBackToSourcePeers())
candidateChildren = peer.Task.Pick(limit, func(candidateNode *supervisor.Peer) bool {
if candidateNode == nil {
Expand Down
1 change: 1 addition & 0 deletions scheduler/supervisor/cdn.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ func (c *cdn) initCDNPeer(ctx context.Context, task *Task, ps *cdnsystem.PieceSe

peer.SetStatus(PeerStatusRunning)
c.peerManager.Add(peer)
peer.Task.Log().Debugf("cdn peer %s has been added", peer.ID)
return peer, nil
}

Expand Down
2 changes: 2 additions & 0 deletions scheduler/supervisor/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ func (task *Task) UpdateSuccess(pieceCount int32, contentLength int64) {

func (task *Task) AddPeer(peer *Peer) {
task.peers.UpdateOrAdd(peer)
task.logger.Debugf("peer %s has been added, current total peer count is %d", peer.ID, task.peers.Size())
}

func (task *Task) UpdatePeer(peer *Peer) {
Expand All @@ -270,6 +271,7 @@ func (task *Task) UpdatePeer(peer *Peer) {

func (task *Task) DeletePeer(peer *Peer) {
task.peers.Delete(peer)
task.logger.Debugf("peer %s has been deleted, current total peer count is %d", peer.ID, task.peers.Size())
}

func (task *Task) GetPeers() *sortedlist.SortedList {
Expand Down

0 comments on commit 51b36b5

Please sign in to comment.