summaryrefslogtreecommitdiff
path: root/src/rhimportd/ctrlWatchDir.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/rhimportd/ctrlWatchDir.go')
-rw-r--r--src/rhimportd/ctrlWatchDir.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/rhimportd/ctrlWatchDir.go b/src/rhimportd/ctrlWatchDir.go
index 1b08e62..14d1c1f 100644
--- a/src/rhimportd/ctrlWatchDir.go
+++ b/src/rhimportd/ctrlWatchDir.go
@@ -165,6 +165,8 @@ func watchDirHandler(conf *rhimport.Config, db *rddb.DBChan, ctx *rhimport.Conte
func watchDirRun(dir *os.File, conf *rhimport.Config, db *rddb.DBChan) {
rhl.Printf("watch-dir-ctrl: watching for files in %s", dir.Name())
+ t := time.NewTicker(1 * time.Second)
+ defer t.Stop()
for {
var err error
if _, err = dir.Seek(0, 0); err != nil {
@@ -199,8 +201,7 @@ func watchDirRun(dir *os.File, conf *rhimport.Config, db *rddb.DBChan) {
}
}
}
-
- time.Sleep(1 * time.Second)
+ <-t.C
}
}