From 8c5c2440fe2fd17aabdce6ef5ef5e5a22f30c41b Mon Sep 17 00:00:00 2001 From: zhengkunwang223 <31820853+zhengkunwang223@users.noreply.github.com> Date: Mon, 8 May 2023 16:03:41 +0700 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=81=9C=E6=AD=A2=E7=BD=91=E7=AB=99=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E7=9A=84=E9=97=AE=E9=A2=98=20(#933)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/cron/job/website.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/cron/job/website.go b/backend/cron/job/website.go index 250bbe1b0..4eb91373b 100644 --- a/backend/cron/job/website.go +++ b/backend/cron/job/website.go @@ -22,7 +22,7 @@ func (w *website) Run() { nyc, _ := time.LoadLocation(common.LoadTimeZone()) websites, _ := repo.NewIWebsiteRepo().List() global.LOG.Info("Website scheduled task in progress ...") - now := time.Now().Add(10 * time.Second) + now := time.Now().Add(10 * time.Minute) if len(websites) > 0 { neverExpireDate, _ := time.Parse(constant.DateLayout, constant.DefaultDate) var wg sync.WaitGroup @@ -30,7 +30,11 @@ func (w *website) Run() { if site.Status != constant.WebRunning || neverExpireDate.Equal(site.ExpireDate) { continue } - expireDate, _ := time.ParseInLocation(constant.DateTimeLayout, site.ExpireDate.String(), nyc) + expireDate, err := time.ParseInLocation(constant.DateLayout, site.ExpireDate.Format(constant.DateLayout), nyc) + if err != nil { + global.LOG.Errorf("time parse err %v", err) + continue + } if expireDate.Before(now) { wg.Add(1) go func(ws model.Website) {