diff --git a/scheduler/resource/cdn.go b/scheduler/resource/cdn.go index 2b32492197c..4b7e1f50c19 100644 --- a/scheduler/resource/cdn.go +++ b/scheduler/resource/cdn.go @@ -37,6 +37,11 @@ import ( "d7y.io/dragonfly/v2/scheduler/config" ) +const ( + // Default value of biz tag for cdn peer + cdnBizTag = "d7y/cdn" +) + type CDN interface { // TriggerTask start to trigger cdn task TriggerTask(context.Context, *Task) (*Peer, *rpcscheduler.PeerResult, error) @@ -146,7 +151,7 @@ func (c *cdn) initPeer(task *Task, ps *cdnsystem.PieceSeed) (*Peer, error) { } // New cdn peer - peer = NewPeer(ps.PeerId, task, host) + peer = NewPeer(ps.PeerId, task, host, WithBizTag(cdnBizTag)) peer.Log.Info("new cdn peer successfully") // Store cdn peer diff --git a/scheduler/resource/peer.go b/scheduler/resource/peer.go index 3807ad51314..32fb70f6ec6 100644 --- a/scheduler/resource/peer.go +++ b/scheduler/resource/peer.go @@ -37,6 +37,9 @@ import ( const ( // Download tiny file timeout downloadTinyFileContextTimeout = 2 * time.Minute + + // Default value of biz tag + defaultBizTag = "unknow" ) const ( @@ -156,6 +159,7 @@ type Peer struct { func NewPeer(id string, task *Task, host *Host, options ...PeerOption) *Peer { p := &Peer{ ID: id, + BizTag: defaultBizTag, Pieces: &bitset.BitSet{}, pieceCosts: []int64{}, Stream: &atomic.Value{},