diff --git a/api/client.go b/api/client.go index 2f174e7a..e7fbd05e 100644 --- a/api/client.go +++ b/api/client.go @@ -259,8 +259,12 @@ func ReqContext(cctx *cli.Context) context.Context { ctx, done := context.WithCancel(tCtx) sigChan := make(chan os.Signal, 2) go func() { - <-sigChan - done() + sig := <-sigChan + log.Warnf("receive sig: %v", sig) + switch sig { + case syscall.SIGTERM: + done() + } }() signal.Notify(sigChan, syscall.SIGTERM, syscall.SIGINT, syscall.SIGHUP) diff --git a/app/venus-worker/main.go b/app/venus-worker/main.go index ff03221b..7c42f94f 100644 --- a/app/venus-worker/main.go +++ b/app/venus-worker/main.go @@ -416,8 +416,8 @@ var runCmd = &cli.Command{ } go func() { - <-ctx.Done() - log.Warn("Shutting down...") + cs := <-ctx.Done() + log.Warnf("Shutting down: %v ...", cs) if err := srv.Shutdown(context.TODO()); err != nil { log.Errorf("shutting down RPC server failed: %s", err) } @@ -505,7 +505,7 @@ var runCmd = &cli.Command{ } select { - case <-readyCh: + case <-readyCh: // 没有tasks后退出 if err := nodeApi.WorkerConnect(ctx, "http://"+address+"/rpc/v0"); err != nil { log.Errorf("Registering worker failed: %+v", err) cancel() @@ -521,7 +521,7 @@ var runCmd = &cli.Command{ } } - log.Errorf("LOTUS-MINER CONNECTION LOST") + log.Errorf("VENUS-MINER CONNECTION LOST") redeclareStorage = true } diff --git a/go.mod b/go.mod index 8988da33..d9f6aa0d 100644 --- a/go.mod +++ b/go.mod @@ -84,5 +84,3 @@ replace github.com/ipfs/go-ipfs-cmds => github.com/ipfs-force-community/go-ipfs- replace github.com/filecoin-project/go-statemachine => github.com/hunjixin/go-statemachine v0.0.0-20210309063909-a65119041e93 replace github.com/filecoin-project/go-statestore => github.com/hunjixin/go-statestore v0.1.1-0.20210309025204-01c69afffbd7 - -replace github.com/filecoin-project/go-jsonrpc => github.com/ipfs-force-community/go-jsonrpc v0.1.4-0.20210721031201-436c3ec1e57e diff --git a/go.sum b/go.sum index 2800615d..41a606b7 100644 --- a/go.sum +++ b/go.sum @@ -316,6 +316,10 @@ github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0/go.mod h1:7aWZdaQ1b16BVoQUYR+ github.com/filecoin-project/go-hamt-ipld/v3 v3.0.1/go.mod h1:gXpNmr3oQx8l3o7qkGyDjJjYSRX7hp/FGOStdqrWyDI= github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0 h1:rVVNq0x6RGQIzCo1iiJlGFm9AGIZzeifggxtKMU7zmI= github.com/filecoin-project/go-hamt-ipld/v3 v3.1.0/go.mod h1:bxmzgT8tmeVQA1/gvBwFmYdT8SOFUwB3ovSUfG1Ux0g= +github.com/filecoin-project/go-jsonrpc v0.1.2/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4= +github.com/filecoin-project/go-jsonrpc v0.1.3/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4= +github.com/filecoin-project/go-jsonrpc v0.1.4-0.20210217175800-45ea43ac2bec h1:rGI5I7fdU4viManxmDdbk5deZO7afe6L1Wc04dAmlOM= +github.com/filecoin-project/go-jsonrpc v0.1.4-0.20210217175800-45ea43ac2bec/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4= github.com/filecoin-project/go-leb128 v0.0.0-20190212224330-8d79a5489543/go.mod h1:mjrHv1cDGJWDlGmC0eDc1E5VJr8DmL9XMUcaFwiuKg8= github.com/filecoin-project/go-multistore v0.0.3 h1:vaRBY4YiA2UZFPK57RNuewypB8u0DzzQwqsL0XarpnI= github.com/filecoin-project/go-multistore v0.0.3/go.mod h1:kaNqCC4IhU4B1uyr7YWFHd23TL4KM32aChS0jNkyUvQ= @@ -676,8 +680,6 @@ github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839 h1:W9WBk7wlPfJLvMCdtV4zPulc4uCPrlywQOmbFOhgQNU= github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= github.com/ipfs-force-community/go-ipfs-cmds v0.6.1-0.20210521090123-4587df7fa0ab/go.mod h1:ZgYiWVnCk43ChwoH8hAmI1IRbuVtq3GSTHwtRB/Kqhk= -github.com/ipfs-force-community/go-jsonrpc v0.1.4-0.20210721031201-436c3ec1e57e h1:aGgOC4obtLKX0uHrsQJZHahuWjTZKwXVljtZ8kREcZU= -github.com/ipfs-force-community/go-jsonrpc v0.1.4-0.20210721031201-436c3ec1e57e/go.mod h1:XBBpuKIMaXIIzeqzO1iucq4GvbF8CxmXRFoezRh+Cx4= github.com/ipfs-force-community/metrics v0.0.0-20210705093944-918711d7932a/go.mod h1:ajvaa2Yv3kernFGYkOVugnapIKawekjQsBPoY+AXMf0= github.com/ipfs-force-community/metrics v0.0.0-20210708103859-bb5906dadf00 h1:nS5cK3ml1THyYX0bDdyGROhhyJf4xQ0+V/SJ46LFmu0= github.com/ipfs-force-community/metrics v0.0.0-20210708103859-bb5906dadf00/go.mod h1:ajvaa2Yv3kernFGYkOVugnapIKawekjQsBPoY+AXMf0=