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>
This commit is contained in:
ijessen-mitll 2025-01-17 07:19:03 -05:00 committed by GitHub
parent 116f275ef5
commit 1f33b5b2ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
}