Skip to content

Commit

Permalink
bugfix: Start filewatcher on different goroutines (#286)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesread committed Apr 21, 2024
1 parent 8f1dfff commit 5057ba2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion internal/entityfiles/entityfiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ func SetupEntityFileWatchers(cfg *config.Config) {
}).Debugf("Adding config dir to entity file path")
}

filehelper.WatchFileWrite(p, func(filename string) {
go filehelper.WatchFileWrite(p, func(filename string) {
loadEntityFile(p, ef.Name)
})

loadEntityFile(p, ef.Name)
}
}

Expand Down
4 changes: 2 additions & 2 deletions internal/onfileindir/fileindir.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
func WatchFilesInDirectory(cfg *config.Config, ex *executor.Executor) {
for _, action := range cfg.Actions {
for _, dirname := range action.ExecOnFileChangedInDir {
filehelper.WatchDirectoryWrite(dirname, func(filename string) {
go filehelper.WatchDirectoryWrite(dirname, func(filename string) {
scheduleExec(action, cfg, ex, filename)
})
}

for _, dirname := range action.ExecOnFileCreatedInDir {
filehelper.WatchDirectoryCreate(dirname, func(filename string) {
go filehelper.WatchDirectoryCreate(dirname, func(filename string) {
scheduleExec(action, cfg, ex, filename)
})
}
Expand Down

0 comments on commit 5057ba2

Please sign in to comment.