1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-01-19 16:29:17 +08:00

fix: 解决网站日志切割失败的问题 (#3573)

This commit is contained in:
ssongliu 2024-01-11 13:53:50 +08:00 committed by GitHub
parent 48713b51f1
commit cb85860ff6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 5 deletions

View File

@ -7,7 +7,6 @@ import (
"path" "path"
"strconv" "strconv"
"strings" "strings"
"sync"
"time" "time"
"github.com/1Panel-dev/1Panel/backend/buserr" "github.com/1Panel-dev/1Panel/backend/buserr"
@ -351,8 +350,6 @@ func (u *CronjobService) handleCutWebsiteLog(cronjob *model.Cronjob, startTime t
} }
baseDir := path.Join(nginx.GetPath(), "www", "sites") baseDir := path.Join(nginx.GetPath(), "www", "sites")
fileOp := files.NewFileOp() fileOp := files.NewFileOp()
var wg sync.WaitGroup
wg.Add(len(websites))
for _, website := range websites { for _, website := range websites {
websiteLogDir := path.Join(baseDir, website.Alias, "log") websiteLogDir := path.Join(baseDir, website.Alias, "log")
srcAccessLogPath := path.Join(websiteLogDir, "access.log") srcAccessLogPath := path.Join(websiteLogDir, "access.log")
@ -380,7 +377,6 @@ func (u *CronjobService) handleCutWebsiteLog(cronjob *model.Cronjob, startTime t
global.LOG.Infof(msg) global.LOG.Infof(msg)
msgs = append(msgs, msg) msgs = append(msgs, msg)
} }
wg.Wait()
u.HandleRmExpired("LOCAL", "", "", cronjob, nil) u.HandleRmExpired("LOCAL", "", "", cronjob, nil)
return msgs, strings.Join(filePaths, ","), err return msgs, strings.Join(filePaths, ","), err
} }

View File

@ -238,7 +238,7 @@ func (u *DatabaseService) Delete(req dto.DatabaseDelete) error {
return err return err
} }
} else { } else {
if err := postgresqlRepo.Delete(context.Background(), mysqlRepo.WithByMysqlName(db.Name)); err != nil && !req.ForceDelete { if err := postgresqlRepo.Delete(context.Background(), postgresqlRepo.WithByPostgresqlName(db.Name)); err != nil && !req.ForceDelete {
return err return err
} }
} }