This is an automated email from the ASF dual-hosted git repository.

alexstocks pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo-go.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new 4185062  graceful shutdwon filter (#1585)
4185062 is described below

commit 41850629095e5048d9702f9ed3d51154b470f77f
Author: wangxw <[email protected]>
AuthorDate: Fri Nov 12 12:46:43 2021 +0800

    graceful shutdwon filter (#1585)
    
    Co-authored-by: wangxiaowei14227 <[email protected]>
---
 filter/gshutdown/filter.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/filter/gshutdown/filter.go b/filter/gshutdown/filter.go
index 6d2b960..f2c3bae 100644
--- a/filter/gshutdown/filter.go
+++ b/filter/gshutdown/filter.go
@@ -33,11 +33,13 @@ import (
 
 func init() {
        // `init()` is performed before config.Load(), so shutdownConfig will 
be retrieved after config was loaded.
+       var csf = &Filter{}
+       var psf = &Filter{}
        extension.SetFilter(constant.GracefulShutdownConsumerFilterKey, func() 
filter.Filter {
-               return &Filter{}
+               return csf
        })
        extension.SetFilter(constant.GracefulShutdownProviderFilterKey, func() 
filter.Filter {
-               return &Filter{}
+               return psf
        })
 }
 
@@ -69,7 +71,7 @@ func (f *Filter) OnResponse(ctx context.Context, result 
protocol.Result, invoker
 func (f *Filter) Set(name string, conf interface{}) {
        switch name {
        case constant.GracefulShutdownFilterShutdownConfig:
-               if shutdownConfig, ok := conf.(*config.ShutdownConfig); !ok {
+               if shutdownConfig, ok := conf.(*config.ShutdownConfig); ok {
                        f.shutdownConfig = shutdownConfig
                        return
                }

Reply via email to