-
Notifications
You must be signed in to change notification settings - Fork 930
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
feature-graceful-shutdwon #1675
Conversation
todo:
|
run |
license, imports block 问题已经解决,ut问题需要再看下,位置 registry/protocol/protocol_test.go:141 |
Codecov Report
@@ Coverage Diff @@
## 3.0 #1675 +/- ##
==========================================
+ Coverage 41.31% 41.39% +0.08%
==========================================
Files 255 256 +1
Lines 14705 14778 +73
==========================================
+ Hits 6076 6118 +42
- Misses 7930 7960 +30
- Partials 699 700 +1
Continue to review full report at Codecov.
|
我在调试完善,先不要合并 |
@@ -33,11 +33,11 @@ func SetFilter(name string, v func() filter.Filter) { | |||
} | |||
|
|||
// GetFilter finds the filter extension with @name | |||
func GetFilter(name string) filter.Filter { | |||
func GetFilter(name string) (filter.Filter, bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
原来返回一个参数感觉更舒服,panic去掉就可以了
timeout := shutdownConfig.GetStepTimeout() | ||
if timeout <= 0 { | ||
return | ||
} | ||
deadline := time.Now().Add(timeout) | ||
|
||
for time.Now().Before(deadline) && !shutdownConfig.RequestsFinished { | ||
for time.Now().Before(deadline) && shutdownConfig.ConsumerActiveCount > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shutdownConfig.ConsumerActiveCount 需要用atomic.Load吧
@@ -124,6 +124,16 @@ func GetApplicationConfig() *ApplicationConfig { | |||
return rootConfig.Application | |||
} | |||
|
|||
func GetShutDown() *ShutdownConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这样写也许更整洁点
if err := check(); err == nil && rootConfig.Shutdown != nil {
return rootConfig.Shutdown
}
return NewShutDownConfigBuilder().Build()
} | ||
deadline := time.Now().Add(timeout) | ||
|
||
for time.Now().Before(deadline) && shutdownConfig.ProviderActiveCount > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
atomic.Load?
reg, err = extension.GetRegistry(registryUrl.Protocol, registryUrl) | ||
if err != nil { | ||
logger.Errorf("Registry can not connect success, program is going to panic.Error message is %s", err.Error()) | ||
panic(err.Error()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panic 直接panic(err) 就可以吧
Fix #1664
of 3.0.1 milestone #1685