mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 02:42:19 +08:00
fix: replace the signal with SIGTERM
This commit is contained in:
parent
1276384180
commit
654248dc5a
@ -21,10 +21,6 @@ import (
|
|||||||
"github.com/OpenIMSDK/tools/errs"
|
"github.com/OpenIMSDK/tools/errs"
|
||||||
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
util "github.com/openimsdk/open-im-server/v3/pkg/util/genutil"
|
||||||
|
|
||||||
"net/http"
|
|
||||||
"os"
|
|
||||||
"os/signal"
|
|
||||||
"syscall"
|
|
||||||
"github.com/OpenIMSDK/tools/mw"
|
"github.com/OpenIMSDK/tools/mw"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||||
"github.com/openimsdk/open-im-server/v3/pkg/common/db/cache"
|
"github.com/openimsdk/open-im-server/v3/pkg/common/db/cache"
|
||||||
@ -38,6 +34,10 @@ import (
|
|||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
"google.golang.org/grpc/credentials/insecure"
|
"google.golang.org/grpc/credentials/insecure"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
"os/signal"
|
||||||
|
"syscall"
|
||||||
)
|
)
|
||||||
|
|
||||||
type MsgTransfer struct {
|
type MsgTransfer struct {
|
||||||
@ -133,7 +133,7 @@ func (m *MsgTransfer) Start(prometheusPort int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sigs := make(chan os.Signal, 1)
|
sigs := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigs, syscall.SIGUSR1)
|
signal.Notify(sigs, syscall.SIGTERM)
|
||||||
select {
|
select {
|
||||||
case <-sigs:
|
case <-sigs:
|
||||||
util.SIGUSR1Exit()
|
util.SIGUSR1Exit()
|
||||||
|
|||||||
@ -64,7 +64,7 @@ func StartTask() error {
|
|||||||
crontab.Start()
|
crontab.Start()
|
||||||
|
|
||||||
sigs := make(chan os.Signal, 1)
|
sigs := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigs, syscall.SIGUSR1)
|
signal.Notify(sigs, syscall.SIGTERM)
|
||||||
<-sigs
|
<-sigs
|
||||||
|
|
||||||
// stop crontab, Wait for the running task to exit.
|
// stop crontab, Wait for the running task to exit.
|
||||||
|
|||||||
@ -134,7 +134,7 @@ func Start(
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
sigs := make(chan os.Signal, 1)
|
sigs := make(chan os.Signal, 1)
|
||||||
signal.Notify(sigs, syscall.SIGUSR1)
|
signal.Notify(sigs, syscall.SIGTERM)
|
||||||
select {
|
select {
|
||||||
case <-sigs:
|
case <-sigs:
|
||||||
util.SIGUSR1Exit()
|
util.SIGUSR1Exit()
|
||||||
|
|||||||
@ -48,5 +48,5 @@ func ExitWithError(err error) {
|
|||||||
|
|
||||||
func SIGUSR1Exit() {
|
func SIGUSR1Exit() {
|
||||||
progName := filepath.Base(os.Args[0])
|
progName := filepath.Base(os.Args[0])
|
||||||
fmt.Printf("\n\n%s receive process terminal SIGUSR1 exit 0\n\n", progName)
|
fmt.Printf("\n\n%s receive process terminal SIGTERM exit 0\n\n", progName)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user