bugfix: Start filewatcher on different goroutines (#286)

This commit is contained in:
James Read 2024-04-21 20:51:49 +01:00 committed by GitHub
parent 8f1dfffa49
commit 5057ba2e1c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 3 deletions

View File

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

View File

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