Skip to content

Commit b48a20d

Browse files
refi64neolynx
authored andcommitted
Use github.com/saracen/walker for file walk operations
In some local tests w/ a slowed down filesystem, this massively cut down on the time to clean up a repository by ~3x, bringing a total 'publish update' time from ~16s to ~13s. Signed-off-by: Ryan Gonzalez <ryan.gonzalez@collabora.com>
1 parent a599bb1 commit b48a20d

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

api/files.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,7 @@ func apiFilesListFiles(c *gin.Context) {
125125
listLock := &sync.Mutex{}
126126
root := filepath.Join(context.UploadPath(), c.Params.ByName("dir"))
127127

128-
err := filepath.Walk(root, func(path string, _ os.FileInfo, err error) error {
129-
if err != nil {
130-
return err
131-
}
132-
128+
err := walker.Walk(root, func(path string, info os.FileInfo) error {
133129
if path == root {
134130
return nil
135131
}

go.mod

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ require (
9494
golang.org/x/net v0.23.0 // indirect
9595
golang.org/x/sync v0.3.0 // indirect
9696
golang.org/x/text v0.14.0 // indirect
97+
golang.org/x/net v0.17.0 // indirect
98+
golang.org/x/sync v0.3.0 // indirect
99+
golang.org/x/text v0.13.0 // indirect
97100
gopkg.in/yaml.v3 v3.0.1 // indirect
98101
)
99102

0 commit comments

Comments
 (0)