1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-11-29 21:47:44 +02:00

fix: "Solve the problem that the resources have not been fully released due to early exit" (#2168)

* Update http.go

Exit before deregister is executed

* Create http.go

Exit before deregister is executed

* Solve the problem that the resources have not been fully released due to early exit

* Optimize some code

* Optimize some code
This commit is contained in:
JeffreyBool
2021-05-17 15:16:52 +08:00
committed by GitHub
parent 4c1f81dadb
commit f48911d2c3
5 changed files with 791 additions and 126 deletions

View File

@@ -13,13 +13,13 @@ type registrySelector struct {
}
func (c *registrySelector) newCache() cache.Cache {
ropts := []cache.Option{}
opts := make([]cache.Option, 0, 1)
if c.so.Context != nil {
if t, ok := c.so.Context.Value("selector_ttl").(time.Duration); ok {
ropts = append(ropts, cache.WithTTL(t))
opts = append(opts, cache.WithTTL(t))
}
}
return cache.New(c.so.Registry, ropts...)
return cache.New(c.so.Registry, opts...)
}
func (c *registrySelector) Init(opts ...Option) error {