镜像自地址
https://github.com/tuna/tunasync.git
已同步 2025-12-07 15:06:47 +00:00
feature(worker): when SIGINT/SIGTERM received, stop all the jobs and update their status before quit. Close #19.
这个提交包含在:
@@ -61,8 +61,9 @@ func startWorker(c *cli.Context) {
|
||||
time.Sleep(1 * time.Second)
|
||||
sigChan := make(chan os.Signal, 1)
|
||||
signal.Notify(sigChan, syscall.SIGHUP)
|
||||
for {
|
||||
s := <-sigChan
|
||||
signal.Notify(sigChan, syscall.SIGINT)
|
||||
signal.Notify(sigChan, syscall.SIGTERM)
|
||||
for s := range sigChan {
|
||||
switch s {
|
||||
case syscall.SIGHUP:
|
||||
logger.Info("Received reload signal")
|
||||
@@ -71,6 +72,8 @@ func startWorker(c *cli.Context) {
|
||||
logger.Errorf("Error loading config: %s", err.Error())
|
||||
}
|
||||
w.ReloadMirrorConfig(newCfg.Mirrors)
|
||||
case syscall.SIGINT, syscall.SIGTERM:
|
||||
w.Halt()
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
在新工单中引用
屏蔽一个用户