mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-11 02:15:48 +02:00
fix(auto-cert): goroutine leaks
This commit is contained in:
parent
07eba99f2b
commit
a00a4f19d2
5 changed files with 9 additions and 3 deletions
|
@ -37,6 +37,7 @@ services:
|
|||
environment:
|
||||
- PEBBLE_VA_NOSLEEP=1
|
||||
- PEBBLE_VA_ALWAYS_VALID=1
|
||||
- PEBBLE_WFE_NONCEREJECT=0
|
||||
networks:
|
||||
nginxui:
|
||||
challtestsrv:
|
||||
|
|
|
@ -82,7 +82,7 @@ export default defineConfig(({ mode }) => {
|
|||
changeOrigin: true,
|
||||
secure: false,
|
||||
ws: true,
|
||||
timeout: 5000,
|
||||
timeout: 60000,
|
||||
agent: new Agent({
|
||||
keepAlive: false,
|
||||
}),
|
||||
|
|
|
@ -113,4 +113,6 @@ func autoCert(certModel *model.Cert) {
|
|||
notification.Error("Sync Certificate Error", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
close(logChan)
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ func IssueCert(payload *ConfigPayload, logChan chan string, errChan chan error)
|
|||
// initial a channelWriter to receive logs
|
||||
cw := NewChannelWriter()
|
||||
defer close(errChan)
|
||||
defer close(cw.Ch)
|
||||
|
||||
// initial a logger
|
||||
l := log.New(os.Stderr, "", log.LstdFlags)
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
package cron
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/0xJacky/Nginx-UI/internal/cert"
|
||||
"github.com/0xJacky/Nginx-UI/internal/logrotate"
|
||||
"github.com/0xJacky/Nginx-UI/query"
|
||||
"github.com/0xJacky/Nginx-UI/settings"
|
||||
"github.com/go-co-op/gocron/v2"
|
||||
"github.com/uozi-tech/cosy/logger"
|
||||
"time"
|
||||
)
|
||||
|
||||
var s gocron.Scheduler
|
||||
|
@ -25,7 +26,8 @@ var logrotateJob gocron.Job
|
|||
func InitCronJobs() {
|
||||
_, err := s.NewJob(gocron.DurationJob(30*time.Minute),
|
||||
gocron.NewTask(cert.AutoCert),
|
||||
gocron.WithSingletonMode(gocron.LimitModeWait))
|
||||
gocron.WithSingletonMode(gocron.LimitModeWait),
|
||||
gocron.JobOption(gocron.WithStartImmediately()))
|
||||
if err != nil {
|
||||
logger.Fatalf("AutoCert Err: %v\n", err)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue