diff options
author | Adam Mathes <adam@trenchant.org> | 2018-07-07 09:01:54 -0700 |
---|---|---|
committer | Adam Mathes <adam@trenchant.org> | 2018-07-07 09:01:54 -0700 |
commit | 16a05c8ddd5b9c81d8f7e671504b892e5d353913 (patch) | |
tree | 57a865c404eb9c4a0322fa1cb705cd4edcbe3cf0 | |
parent | cdc1f64031af949874fed73e1d51247dd4226660 (diff) | |
download | neko-16a05c8ddd5b9c81d8f7e671504b892e5d353913.tar.gz neko-16a05c8ddd5b9c81d8f7e671504b892e5d353913.tar.bz2 neko-16a05c8ddd5b9c81d8f7e671504b892e5d353913.zip |
simpler background crawler attempt #2
-rw-r--r-- | main.go | 16 |
1 files changed, 2 insertions, 14 deletions
@@ -74,20 +74,8 @@ func main() { } func backgroundCrawl(minutes int) { - if minutes < 1 { - return - } - ticker := time.NewTicker(time.Minute * time.Duration(minutes)) - defer ticker.Stop() - done := make(chan bool) for { - select { - case <-done: - fmt.Println("done") - return - case t := <-ticker.C: - vlog.Printf("starting crawl at %s\n", t) - crawler.Crawl() - } + time.Sleep(time.Minute * time.Duration(minutes)) + crawler.Crawl() } } |