Skip to content

Commit c553a2c

Browse files
fix(lock): skip .dolt-data, .dolt-backup, .git in FindAllLocks walk
filepath.Walk over the entire town root takes 2+ minutes on Docker bind mounts (macOS VirtioFS) due to 180k+ files in Dolt storage and git objects. Skip these directories since they never contain agent locks. Co-Authored-By: Claude
1 parent 93e5d25 commit c553a2c

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

internal/lock/lock.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,17 +220,24 @@ func (l *Lock) write(sessionID string) error {
220220
return nil
221221
}
222222

223-
// FindAllLocks scans a directory tree for agent.lock files.
223+
// FindAllLocks scans for agent.lock files, skipping large internal
224+
// directories (.dolt-data, .git) that are extremely slow to walk on
225+
// Docker bind mounts (macOS VirtioFS).
224226
// Returns a map of worker directory -> LockInfo.
225227
func FindAllLocks(root string) (map[string]*LockInfo, error) {
226228
locks := make(map[string]*LockInfo)
227229

228230
err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
229231
if err != nil {
230-
return nil // Skip errors
232+
return nil
231233
}
232234

235+
// Skip large internal directories that never contain agent locks.
233236
if info.IsDir() {
237+
name := info.Name()
238+
if name == ".dolt-data" || name == ".dolt-backup" || name == ".git" {
239+
return filepath.SkipDir
240+
}
234241
return nil
235242
}
236243

0 commit comments

Comments
 (0)