Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] graceful shutdwon filter #1585

Merged
merged 1 commit into from
Nov 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions filter/gshutdown/filter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
}

Expand Down Expand Up @@ -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
}
Expand Down