This commit is contained in:
parent
d4cd0bd2d1
commit
1cfe78538d
@ -40,7 +40,9 @@ func (c *CoachOutlet) SetOption(cfg model.WatchInfo) {
|
||||
}
|
||||
|
||||
func (c *CoachOutlet) Cancel() {
|
||||
c.cancel()
|
||||
if c.cancel != nil {
|
||||
c.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
func (c *CoachOutlet) Restart() {
|
||||
|
@ -127,7 +127,7 @@ func (c *Controller) List(req ListWatcherInfoRequest) (resp web.ListResponse[mod
|
||||
}
|
||||
offset := (req.Page - 1) * req.Size
|
||||
|
||||
if err = tx.Order("created_at desc").Limit(req.Size).Offset(offset).
|
||||
if err = tx.Order("created_at desc").Limit(req.Size).Offset(offset).Preload("Pushers").
|
||||
Find(&resp.List).Error; err != nil {
|
||||
return resp, fmt.Errorf("查询列表失败:%v", err)
|
||||
}
|
||||
@ -146,7 +146,7 @@ func (c *Controller) Delete(uid string) error {
|
||||
|
||||
func (c *Controller) Stop(uid string) error {
|
||||
c.lock.RLock()
|
||||
if watcher, ok := c.m[uid]; ok {
|
||||
if watcher, ok := c.m[uid]; ok && watcher != nil {
|
||||
watcher.Cancel()
|
||||
}
|
||||
c.lock.RUnlock()
|
||||
|
Loading…
Reference in New Issue
Block a user