This commit is contained in:
parent
d4cd0bd2d1
commit
1cfe78538d
@ -40,8 +40,10 @@ func (c *CoachOutlet) SetOption(cfg model.WatchInfo) {
|
||||
}
|
||||
|
||||
func (c *CoachOutlet) Cancel() {
|
||||
if c.cancel != nil {
|
||||
c.cancel()
|
||||
}
|
||||
}
|
||||
|
||||
func (c *CoachOutlet) Restart() {
|
||||
c.Cancel()
|
||||
|
@ -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