mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2025-01-19 08:19:15 +08:00
fix: 解决定时任务停止网站失败的问题 (#933)
This commit is contained in:
parent
f22caed20c
commit
8c5c2440fe
@ -22,7 +22,7 @@ func (w *website) Run() {
|
|||||||
nyc, _ := time.LoadLocation(common.LoadTimeZone())
|
nyc, _ := time.LoadLocation(common.LoadTimeZone())
|
||||||
websites, _ := repo.NewIWebsiteRepo().List()
|
websites, _ := repo.NewIWebsiteRepo().List()
|
||||||
global.LOG.Info("Website scheduled task in progress ...")
|
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 {
|
if len(websites) > 0 {
|
||||||
neverExpireDate, _ := time.Parse(constant.DateLayout, constant.DefaultDate)
|
neverExpireDate, _ := time.Parse(constant.DateLayout, constant.DefaultDate)
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
@ -30,7 +30,11 @@ func (w *website) Run() {
|
|||||||
if site.Status != constant.WebRunning || neverExpireDate.Equal(site.ExpireDate) {
|
if site.Status != constant.WebRunning || neverExpireDate.Equal(site.ExpireDate) {
|
||||||
continue
|
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) {
|
if expireDate.Before(now) {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go func(ws model.Website) {
|
go func(ws model.Website) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user