forked from TrueCloudLab/frostfs-http-gw
refactoring pool, replace zap.Duration with zap.Stringer
This commit is contained in:
parent
cf61136da5
commit
62c6bbd875
3 changed files with 47 additions and 16 deletions
16
main.go
16
main.go
|
@ -23,6 +23,9 @@ type router struct {
|
|||
|
||||
func main() {
|
||||
var (
|
||||
err error
|
||||
pool *Pool
|
||||
|
||||
v = settings()
|
||||
l = newLogger(v)
|
||||
g = newGracefulContext(l)
|
||||
|
@ -32,10 +35,21 @@ func main() {
|
|||
grpclog.SetLoggerV2(gRPCLogger(l))
|
||||
}
|
||||
|
||||
switch pool, err = newPool(g, l, v); {
|
||||
case err == nil:
|
||||
// ignore
|
||||
case errors.Is(err, context.Canceled):
|
||||
l.Info("close application")
|
||||
return
|
||||
default:
|
||||
l.Error("could get connection", zap.Error(err))
|
||||
return
|
||||
}
|
||||
|
||||
r := &router{
|
||||
log: l,
|
||||
pool: pool,
|
||||
key: fetchKey(l, v),
|
||||
pool: newPool(g, l, v),
|
||||
timeout: v.GetDuration("request_timeout"),
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue