summaryrefslogtreecommitdiff
path: root/src/rhimportd/ctrlWatchDir.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-04-02 16:53:16 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-04-02 16:53:16 (GMT)
commit374cabeb4d2d59b588e9d4a30e3c09e2dbc0abdd (patch)
tree06bd6587085c6a572bee5077c440b445a4479b6a /src/rhimportd/ctrlWatchDir.go
parent27eaf84de6c5900c739f73725bd07270d43d49b7 (diff)
parent761d6d0824c0cc92fc746b77499ac563f4e6e579 (diff)
Merge branch 'upload-feature'
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
}
}