diff --git a/persist/sqlite/store.go b/persist/sqlite/store.go index 54f14dd2..9bbeea1c 100644 --- a/persist/sqlite/store.go +++ b/persist/sqlite/store.go @@ -39,10 +39,10 @@ func (s *Store) exec(query string, args ...any) (sql.Result, error) { func (s *Store) prepare(query string) (*loggedStmt, error) { start := time.Now() stmt, err := s.db.Prepare(query) - if dur := time.Since(start); dur > longQueryDuration { - s.log.Debug("slow prepare", zap.String("query", query), zap.Duration("elapsed", dur), zap.Stack("stack")) - } else if err != nil { + if err != nil { return nil, err + } else if dur := time.Since(start); dur > longQueryDuration { + s.log.Debug("slow prepare", zap.String("query", query), zap.Duration("elapsed", dur), zap.Stack("stack")) } return &loggedStmt{ Stmt: stmt,