You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2019/09/02 06:53:00 UTC
[dubbo-go] branch develop updated: tim.AfterFunc
This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git
The following commit(s) were added to refs/heads/develop by this push:
new b02dad6 tim.AfterFunc
new 8c2ddb6 Merge pull request #181 from dubbo-x/develop
b02dad6 is described below
commit b02dad625adb4c1a94c7fc40dd84f8b82049b556
Author: 高辛格 <xg...@tianrang-inc.com>
AuthorDate: Fri Aug 30 10:01:32 2019 +0800
tim.AfterFunc
---
examples/consul/go-server/server.go | 2 +-
examples/generic/go-client/app/client.go | 4 ---
.../dubbo/with-hystrix-go-client/app/client.go | 32 ----------------------
3 files changed, 1 insertion(+), 37 deletions(-)
diff --git a/examples/consul/go-server/server.go b/examples/consul/go-server/server.go
index 798fe7c..0e1e1f6 100644
--- a/examples/consul/go-server/server.go
+++ b/examples/consul/go-server/server.go
@@ -57,7 +57,7 @@ func initSignal() {
case syscall.SIGHUP:
// reload()
default:
- go time.AfterFunc(time.Duration(float64(survivalTimeout)*float64(time.Second)), func() {
+ time.AfterFunc(time.Duration(float64(survivalTimeout)*float64(time.Second)), func() {
logger.Warnf("app exit now by force...")
os.Exit(1)
})
diff --git a/examples/generic/go-client/app/client.go b/examples/generic/go-client/app/client.go
index 8d5a1bc..dbd4665 100644
--- a/examples/generic/go-client/app/client.go
+++ b/examples/generic/go-client/app/client.go
@@ -35,10 +35,6 @@ import (
_ "github.com/apache/dubbo-go/registry/zookeeper"
)
-var (
- survivalTimeout int = 10e9
-)
-
// they are necessary:
// export CONF_CONSUMER_FILE_PATH="xxx"
// export APP_LOG_CONF_FILE="xxx"
diff --git a/examples/hystrixfilter/dubbo/with-hystrix-go-client/app/client.go b/examples/hystrixfilter/dubbo/with-hystrix-go-client/app/client.go
index 0d8d7d2..e759465 100644
--- a/examples/hystrixfilter/dubbo/with-hystrix-go-client/app/client.go
+++ b/examples/hystrixfilter/dubbo/with-hystrix-go-client/app/client.go
@@ -20,9 +20,6 @@ package main
import (
"context"
"fmt"
- "os"
- "os/signal"
- "syscall"
"time"
)
@@ -44,10 +41,6 @@ import (
_ "github.com/apache/dubbo-go/registry/zookeeper"
)
-var (
- survivalTimeout int = 10e9
-)
-
// they are necessary:
// export CONF_CONSUMER_FILE_PATH="xxx"
// export APP_LOG_CONF_FILE="xxx"
@@ -102,29 +95,4 @@ func main() {
resGot := <-getUser1Chan
logger.Infof("[GetUser1] %v", resGot)
}
- //initSignal()
-}
-
-func initSignal() {
- signals := make(chan os.Signal, 1)
- // It is not possible to block SIGKILL or syscall.SIGSTOP
- signal.Notify(signals, os.Interrupt, os.Kill, syscall.SIGHUP,
- syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)
- for {
- sig := <-signals
- logger.Infof("get signal %s", sig.String())
- switch sig {
- case syscall.SIGHUP:
- // reload()
- default:
- go time.AfterFunc(time.Duration(survivalTimeout)*time.Second, func() {
- logger.Warnf("app exit now by force...")
- os.Exit(1)
- })
-
- // 要么fastFailTimeout时间内执行完毕下面的逻辑然后程序退出,要么执行上面的超时函数程序强行退出
- fmt.Println("app exit now...")
- return
- }
- }
}