fix 修复重新watch状态未变更的bug
This commit is contained in:
parent
c19da13793
commit
20a040ed7f
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/go-resty/resty/v2"
|
"github.com/go-resty/resty/v2"
|
||||||
|
"github.com/golang/glog"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/timerzz/proxypool/pkg/proxy"
|
"github.com/timerzz/proxypool/pkg/proxy"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
@ -85,6 +86,11 @@ func (c *CoachOutlet) Restart() {
|
|||||||
}
|
}
|
||||||
func (c *CoachOutlet) Watch() {
|
func (c *CoachOutlet) Watch() {
|
||||||
c.ctx, c.cancel = context.WithCancel(c.fCtx)
|
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()
|
c.getDetail()
|
||||||
ticker := time.NewTicker(c.cfg.Interval)
|
ticker := time.NewTicker(c.cfg.Interval)
|
||||||
defer ticker.Stop()
|
defer ticker.Stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user