From 20a040ed7fe048bbee609942eabc3d76d5766016 Mon Sep 17 00:00:00 2001 From: timerzz Date: Thu, 11 Apr 2024 20:36:58 +0800 Subject: [PATCH] =?UTF-8?q?=20fix=20=E4=BF=AE=E5=A4=8D=E9=87=8D=E6=96=B0wa?= =?UTF-8?q?tch=E7=8A=B6=E6=80=81=E6=9C=AA=E5=8F=98=E6=9B=B4=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/watcher/coach.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/watcher/coach.go b/pkg/watcher/coach.go index 75e9ba2..554544e 100644 --- a/pkg/watcher/coach.go +++ b/pkg/watcher/coach.go @@ -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()