fix 修复重新watch状态未变更的bug

This commit is contained in:
timerzz 2024-04-11 20:36:58 +08:00
parent c19da13793
commit 20a040ed7f

View File

@ -4,6 +4,7 @@ import (
"context"
"fmt"
"github.com/go-resty/resty/v2"
"github.com/golang/glog"
"github.com/pkg/errors"
"github.com/timerzz/proxypool/pkg/proxy"
"gorm.io/gorm"
@ -85,6 +86,11 @@ func (c *CoachOutlet) Restart() {
}
func (c *CoachOutlet) Watch() {
c.ctx, c.cancel = context.WithCancel(c.fCtx)
if err := c.db.Model(&model.Product{}).Updates(map[string]interface{}{"watch": true, "orderable": false}).Error; err != nil {
glog.Errorf("watch update db err: %v", err)
err = nil
}
c.getDetail()
ticker := time.NewTicker(c.cfg.Interval)
defer ticker.Stop()