diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-04-02 16:53:16 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-04-02 16:53:16 (GMT) |
commit | 374cabeb4d2d59b588e9d4a30e3c09e2dbc0abdd (patch) | |
tree | 06bd6587085c6a572bee5077c440b445a4479b6a /src/rhimportd/ctrlWatchDir.go | |
parent | 27eaf84de6c5900c739f73725bd07270d43d49b7 (diff) | |
parent | 761d6d0824c0cc92fc746b77499ac563f4e6e579 (diff) |
Merge branch 'upload-feature'
Diffstat (limited to 'src/rhimportd/ctrlWatchDir.go')
-rw-r--r-- | src/rhimportd/ctrlWatchDir.go | 5 |
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 } } |