From 1f33b5b2ba4cf6cb1c78a0b349b32a7d9df34b6d Mon Sep 17 00:00:00 2001 From: ijessen-mitll <127329433+ijessen-mitll@users.noreply.github.com> Date: Fri, 17 Jan 2025 07:19:03 -0500 Subject: [PATCH] playback: improve performance (#4152) * change from filepath.Walk to filepath.WalkDir * use filepath.WalkDir in the entire project --------- Co-authored-by: aler9 <46489434+aler9@users.noreply.github.com> --- internal/recordstore/segment.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/recordstore/segment.go b/internal/recordstore/segment.go index b1a1574d..7e95444a 100644 --- a/internal/recordstore/segment.go +++ b/internal/recordstore/segment.go @@ -34,7 +34,7 @@ func fixedPathHasSegments(pathConf *conf.Path) bool { commonPath := CommonPath(recordPath) - err := filepath.Walk(commonPath, func(fpath string, info fs.FileInfo, err error) error { + err := filepath.WalkDir(commonPath, func(fpath string, info fs.DirEntry, err error) error { if err != nil { return err } @@ -70,7 +70,7 @@ func regexpPathFindPathsWithSegments(pathConf *conf.Path) map[string]struct{} { ret := make(map[string]struct{}) - filepath.Walk(commonPath, func(fpath string, info fs.FileInfo, err error) error { //nolint:errcheck + filepath.WalkDir(commonPath, func(fpath string, info fs.DirEntry, err error) error { //nolint:errcheck if err != nil { return err } @@ -136,7 +136,7 @@ func FindSegments( commonPath := CommonPath(recordPath) var segments []*Segment - err := filepath.Walk(commonPath, func(fpath string, info fs.FileInfo, err error) error { + err := filepath.WalkDir(commonPath, func(fpath string, info fs.DirEntry, err error) error { if err != nil { return err }