Merge pull request #15842 from qsyqian/main

log time when open backend db took too long
This commit is contained in:
Benjamin Wang 2023-05-09 06:06:21 +08:00 committed by GitHub
commit 3024d9461d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,9 +76,12 @@ func OpenBackend(cfg config.ServerConfig, hooks backend.Hooks) backend.Backend {
beOpened <- newBackend(cfg, hooks)
}()
defer func() {
cfg.Logger.Info("opened backend db", zap.String("path", fn), zap.Duration("took", time.Since(now)))
}()
select {
case be := <-beOpened:
cfg.Logger.Info("opened backend db", zap.String("path", fn), zap.Duration("took", time.Since(now)))
return be
case <-time.After(10 * time.Second):