log time when open backend db took too long
Signed-off-by: qsyqian <qsyqian@gmail.com>
This commit is contained in:
@ -76,9 +76,12 @@ func OpenBackend(cfg config.ServerConfig, hooks backend.Hooks) backend.Backend {
|
|||||||
beOpened <- newBackend(cfg, hooks)
|
beOpened <- newBackend(cfg, hooks)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
cfg.Logger.Info("opened backend db", zap.String("path", fn), zap.Duration("took", time.Since(now)))
|
||||||
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case be := <-beOpened:
|
case be := <-beOpened:
|
||||||
cfg.Logger.Info("opened backend db", zap.String("path", fn), zap.Duration("took", time.Since(now)))
|
|
||||||
return be
|
return be
|
||||||
|
|
||||||
case <-time.After(10 * time.Second):
|
case <-time.After(10 * time.Second):
|
||||||
|
Reference in New Issue
Block a user